rime / librime

Rime Input Method Engine, the core library
https://rime.im
BSD 3-Clause "New" or "Revised" License
3.35k stars 546 forks source link

librime1.3.0 用户词库同步,不会合并同步位置所有用户的词库,只会更新当前用户的词库。 #194

Closed wrlssqi closed 6 years ago

wrlssqi commented 6 years ago

weasel 0.10.0遇到了用户同步问题,同步时,其不会合并所有id目录下的词库,而只会更新自己id文件夹下的词库。在weasel下提交了个issue,经开发者提醒,在此项目下重新提交。 https://github.com/rime/weasel/issues/149

lotem commented 6 years ago

符合設計。 每個 installation ID 對應一個文件夾,反映一臺機器上的最新的用戶數據。因此,本機的數據固定上傳到一個同步文件夾。而在同步過程中會合併來自其他同步目錄的用戶詞典。

wrlssqi commented 6 years ago

可能是我没有表述清楚。我指的就是在同步过程中,没有合并来自其他目录的用户词典,所以我认为同步功能出现了错误。 我来描述一下完整的同步流程。当前机器小狼毫id为3e2f8018-8658-4b4a-87fc-7c02e539992e。

  1. 删除本地机器用户目录下的词库 image
  2. 删除同步目录里本机id文件夹下的词库 image
  3. 确认同步目录里其他id文件夹下有词库 image
  4. 执行用户同步后,本地用户文件夹下词库里的内容。可以看到文件都很小,没有将其他id文件夹下那个409k的皓月拼音词库合并到本地 image 5.执行用户同步后的同步文件夹内,词库文件很小,且内容为空 image 同步过程的日志如下: I0323 14:49:07.141911 5240 core_module.cc:20] registering core components. I0323 14:49:07.143911 5240 registry.cc:14] registering component: config_builder I0323 14:49:07.143911 5240 registry.cc:14] registering component: config I0323 14:49:07.143911 5240 registry.cc:14] registering component: schema I0323 14:49:07.143911 5240 registry.cc:14] registering component: user_config I0323 14:49:07.143911 5240 dict_module.cc:24] registering components from module 'dict'. I0323 14:49:07.143911 5240 registry.cc:14] registering component: tabledb I0323 14:49:07.143911 5240 registry.cc:14] registering component: stabledb I0323 14:49:07.143911 5240 registry.cc:14] registering component: plain_userdb I0323 14:49:07.143911 5240 registry.cc:14] registering component: userdb I0323 14:49:07.143911 5240 registry.cc:14] registering component: dictionary I0323 14:49:07.143911 5240 registry.cc:14] registering component: reverse_lookup_dictionary I0323 14:49:07.143911 5240 registry.cc:14] registering component: user_dictionary I0323 14:49:07.143911 5240 registry.cc:14] registering component: userdb_recovery_task I0323 14:49:07.143911 5240 levers_module.cc:23] registering components from module 'levers'. I0323 14:49:07.143911 5240 registry.cc:14] registering component: detect_modifications I0323 14:49:07.143911 5240 registry.cc:14] registering component: installation_update I0323 14:49:07.143911 5240 registry.cc:14] registering component: workspace_update I0323 14:49:07.143911 5240 registry.cc:14] registering component: schema_update I0323 14:49:07.143911 5240 registry.cc:14] registering component: config_file_update I0323 14:49:07.143911 5240 registry.cc:14] registering component: prebuild_all_schemas I0323 14:49:07.143911 5240 registry.cc:14] registering component: user_dict_upgrade I0323 14:49:07.143911 5240 registry.cc:14] registering component: cleanup_trash I0323 14:49:07.143911 5240 registry.cc:14] registering component: user_dict_sync I0323 14:49:07.143911 5240 registry.cc:14] registering component: backup_config_files I0323 14:49:07.143911 5240 registry.cc:14] registering component: clean_old_log_files I0323 14:49:07.155943 5240 deployer.cc:114] starting work thread for 3 tasks. I0323 14:49:07.166975 19124 deployer.cc:83] running deployment tasks: I0323 14:49:07.166975 19124 deployment_tasks.cc:80] updating rime installation info. I0323 14:49:07.166975 19124 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\installation.yaml'. I0323 14:49:07.167990 19124 deployment_tasks.cc:98] installation info exists. installation id: 3e2f8018-8658-4b4a-87fc-7c02e539992e I0323 14:49:07.167990 19124 deployment_tasks.cc:106] sync dir: C:\Users\wrlss\OneDrive\RimeSync I0323 14:49:07.167990 19124 deployment_tasks.cc:108] previous distribution: Weasel I0323 14:49:07.167990 19124 deployment_tasks.cc:111] previous distribution version: 0.10.0 I0323 14:49:07.167990 19124 deployment_tasks.cc:114] previous Rime version: 1.3.0 I0323 14:49:07.167990 19124 deployment_tasks.cc:521] backing up config files. I0323 14:49:07.180511 19124 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\user.yaml'. I0323 14:49:07.186527 19124 deployment_tasks.cc:565] backed up 1 config files to C:\Users\wrlss\OneDrive\RimeSync\3e2f8018-8658-4b4a-87fc-7c02e539992e, 0 failed, 6 up-to-date, 0 skipped. I0323 14:49:07.187530 19124 user_dict_manager.cc:223] synchronizing 1 user dicts. I0323 14:49:07.187530 19124 user_dict_manager.cc:189] synchronize user dict 'luna_pinyin'. I0323 14:49:07.204080 19124 user_db.cc:123] backing up userdb 'luna_pinyin.userdb' to C:\Users\wrlss\OneDrive\RimeSync\3e2f8018-8658-4b4a-87fc-7c02e539992e\luna_pinyin.userdb.txt I0323 14:49:07.204080 19124 tsv.cc:62] writing tsv file: C:\Users\wrlss\OneDrive\RimeSync\3e2f8018-8658-4b4a-87fc-7c02e539992e\luna_pinyin.userdb.txt I0323 14:49:07.210109 19124 level_db.cc:302] closed db 'luna_pinyin.userdb'. I0323 14:49:07.210109 19124 deployer.cc:95] 3 tasks ran: 3 success, 0 failure.
wrlssqi commented 6 years ago

我两台win10 设备,使用小狼毫0.10.0,都出现了不合并其他用户id词库的现象。linux环境最近被搞崩了,所以暂时没法测试linux下是否也有此同步问题。

X1aomu commented 6 years ago

我觉得可能是公子这边没有表述清楚。

符合設計。 每個 installation ID 對應一個文件夾,反映一臺機器上的最新的用戶數據。因此,本機的數據固定上传到一個同步文件夾。而在同步過程中會合併來自其他同步目錄的用戶詞典。

"本機的數據固定上传到一個同步文件夾“ 应该是等同于 "不合并其他用户id词库",而 “合併來自其他同步目錄的用戶詞典” 我也不是很理解了 @lotem

个人是赞同设计上在同步过程中不合并其他用户id词库的做法的,不同的 id 实际上代表了不同的使用者,把两个不同的使用者的文件同步到一块不合适。

wrlssqi commented 6 years ago

@X1aomu rime在用户同步这一功能的设计上,是要同步其他用户id的词库的,而且之前用的osfans的prime,以及linux下的ibus-rime(当时的librime版本应该是用的1.2.9)都可以做到这一点。而且同步其他id用户的词库这个功能是写在了使用手册介绍里的。这个功能的使用场景是,用户有多台设备都使用rime,就可以通过用户同步功能统一词库了

wrlssqi commented 6 years ago

目前暂时通过小狼毫的用户词典管理工具手动合并其他id下的词库 image

lotem commented 6 years ago

在 macOS 上用鼠鬚管試下,可以同步。 有可能是小狼毫對同步功能的調用出了問題。還需要進一步驗證。

lotem commented 6 years ago

小狼毫 0.10 未重現

lotem commented 6 years ago

sync_dir 路徑裏面有空格/中文字嘛?

wrlssqi commented 6 years ago

没有空格和中文字符。我是用的onedrive目录,在我其中一台设备上的完整目录如下 image 是否有可能我用的是C盘目录,权限问题?不过如果是权限不够的话,它应该连同步自己id目录下的东西也做不到的吧(若权限不够,无法读写,那应该无法写入任何东西)? 我抽空换个目录试试吧,有信息再反馈。

wrlssqi commented 6 years ago

还真的和同步目录的位置有关。我将同步目录位置更改在D盘一个测试目录下 image

将其余两个id目录复制到这里,然后清空本机小狼毫用户文件夹下的词库后,同步,成功合并了其余id的词库。从日志文件里也能看到合并其它目录的记录出现。而之前,同步目录设置在C:\Users\wrlss\OneDrive\RimeSync时的日志里,是没有merging出现的。 Log file created at: 2018/04/09 21:28:07 Running on machine: DESKTOP-1311TS6 Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg I0409 21:28:07.465627 13848 core_module.cc:20] registering core components. I0409 21:28:07.467627 13848 registry.cc:14] registering component: config_builder I0409 21:28:07.467627 13848 registry.cc:14] registering component: config I0409 21:28:07.467627 13848 registry.cc:14] registering component: schema I0409 21:28:07.467627 13848 registry.cc:14] registering component: user_config I0409 21:28:07.467627 13848 dict_module.cc:24] registering components from module 'dict'. I0409 21:28:07.467627 13848 registry.cc:14] registering component: tabledb I0409 21:28:07.467627 13848 registry.cc:14] registering component: stabledb I0409 21:28:07.467627 13848 registry.cc:14] registering component: plain_userdb I0409 21:28:07.467627 13848 registry.cc:14] registering component: userdb I0409 21:28:07.467627 13848 registry.cc:14] registering component: dictionary I0409 21:28:07.467627 13848 registry.cc:14] registering component: reverse_lookup_dictionary I0409 21:28:07.467627 13848 registry.cc:14] registering component: user_dictionary I0409 21:28:07.467627 13848 registry.cc:14] registering component: userdb_recovery_task I0409 21:28:07.467627 13848 levers_module.cc:23] registering components from module 'levers'. I0409 21:28:07.467627 13848 registry.cc:14] registering component: detect_modifications I0409 21:28:07.467627 13848 registry.cc:14] registering component: installation_update I0409 21:28:07.467627 13848 registry.cc:14] registering component: workspace_update I0409 21:28:07.467627 13848 registry.cc:14] registering component: schema_update I0409 21:28:07.467627 13848 registry.cc:14] registering component: config_file_update I0409 21:28:07.467627 13848 registry.cc:14] registering component: prebuild_all_schemas I0409 21:28:07.467627 13848 registry.cc:14] registering component: user_dict_upgrade I0409 21:28:07.467627 13848 registry.cc:14] registering component: cleanup_trash I0409 21:28:07.467627 13848 registry.cc:14] registering component: user_dict_sync I0409 21:28:07.467627 13848 registry.cc:14] registering component: backup_config_files I0409 21:28:07.467627 13848 registry.cc:14] registering component: clean_old_log_files I0409 21:28:07.472640 13848 deployer.cc:114] starting work thread for 3 tasks. I0409 21:28:07.492699 4852 deployer.cc:83] running deployment tasks: I0409 21:28:07.492699 4852 deployment_tasks.cc:80] updating rime installation info. I0409 21:28:07.492699 4852 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\installation.yaml'. I0409 21:28:07.493696 4852 deployment_tasks.cc:98] installation info exists. installation id: 3e2f8018-8658-4b4a-87fc-7c02e539992e I0409 21:28:07.493696 4852 deployment_tasks.cc:106] sync dir: D:/Rimetest I0409 21:28:07.493696 4852 deployment_tasks.cc:108] previous distribution: Weasel I0409 21:28:07.493696 4852 deployment_tasks.cc:111] previous distribution version: 0.11.0 I0409 21:28:07.493696 4852 deployment_tasks.cc:114] previous Rime version: 1.3.1 I0409 21:28:07.493696 4852 deployment_tasks.cc:532] backing up config files. I0409 21:28:07.497706 4852 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\double_pinyin_flypy.schema.yaml'. I0409 21:28:07.501718 4852 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\emoji.dict.yaml'. I0409 21:28:07.503726 4852 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\emoji.schema.yaml'. I0409 21:28:07.506235 4852 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\installation.yaml'. I0409 21:28:07.508240 4852 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\user.yaml'. I0409 21:28:07.511842 4852 deployment_tasks.cc:571] backed up 7 config files to D:/Rimetest\3e2f8018-8658-4b4a-87fc-7c02e539992e, 0 failed, 0 up-to-date, 0 skipped. I0409 21:28:07.512877 4852 user_dict_manager.cc:223] synchronizing 1 user dicts. I0409 21:28:07.512877 4852 user_dict_manager.cc:189] synchronize user dict 'luna_pinyin'. I0409 21:28:07.512877 4852 user_dict_manager.cc:206] merging snapshot file: D:/Rimetest\e1d9ce28-6cff-4c9f-9da4-1b4e96a6c648\luna_pinyin.userdb.txt I0409 21:28:07.524108 4852 db.cc:50] creating metadata for db '.temp.userdb'. I0409 21:28:07.524108 4852 user_db.cc:139] restoring userdb '.temp.userdb' from D:/Rimetest\e1d9ce28-6cff-4c9f-9da4-1b4e96a6c648\luna_pinyin.userdb.txt I0409 21:28:07.524108 4852 tsv.cc:17] reading tsv file: D:/Rimetest\e1d9ce28-6cff-4c9f-9da4-1b4e96a6c648\luna_pinyin.userdb.txt I0409 21:28:07.677045 4852 user_dict_manager.cc:100] merging 'D:/Rimetest\e1d9ce28-6cff-4c9f-9da4-1b4e96a6c648\luna_pinyin.userdb.txt' from e1d9ce28-6cff-4c9f-9da4-1b4e96a6c648 into userdb 'luna_pinyin'... I0409 21:28:07.940176 4852 user_db.cc:249] total 9082 entries merged, tick = 26401 I0409 21:28:07.943697 4852 level_db.cc:302] closed db 'luna_pinyin.userdb'. I0409 21:28:07.945909 4852 level_db.cc:302] closed db '.temp.userdb'. I0409 21:28:07.949946 4852 user_dict_manager.cc:206] merging snapshot file: D:/Rimetest\f76af28a-c45d-4b89-a57a-89715a77ce4d\luna_pinyin.userdb.txt I0409 21:28:07.960041 4852 db.cc:50] creating metadata for db '.temp.userdb'. I0409 21:28:07.960041 4852 user_db.cc:139] restoring userdb '.temp.userdb' from D:/Rimetest\f76af28a-c45d-4b89-a57a-89715a77ce4d\luna_pinyin.userdb.txt I0409 21:28:07.960041 4852 tsv.cc:17] reading tsv file: D:/Rimetest\f76af28a-c45d-4b89-a57a-89715a77ce4d\luna_pinyin.userdb.txt I0409 21:28:08.088392 4852 user_dict_manager.cc:100] merging 'D:/Rimetest\f76af28a-c45d-4b89-a57a-89715a77ce4d\luna_pinyin.userdb.txt' from f76af28a-c45d-4b89-a57a-89715a77ce4d into userdb 'luna_pinyin'... I0409 21:28:08.420877 4852 user_db.cc:249] total 8978 entries merged, tick = 26401 I0409 21:28:08.423698 4852 level_db.cc:302] closed db 'luna_pinyin.userdb'. I0409 21:28:08.426205 4852 level_db.cc:302] closed db '.temp.userdb'. I0409 21:28:08.450062 4852 user_db.cc:123] backing up userdb 'luna_pinyin.userdb' to D:/Rimetest\3e2f8018-8658-4b4a-87fc-7c02e539992e\luna_pinyin.userdb.txt I0409 21:28:08.450062 4852 tsv.cc:62] writing tsv file: D:/Rimetest\3e2f8018-8658-4b4a-87fc-7c02e539992e\luna_pinyin.userdb.txt I0409 21:28:08.536830 4852 level_db.cc:302] closed db 'luna_pinyin.userdb'. I0409 21:28:08.536830 4852 deployer.cc:95] 3 tasks ran: 3 success, 0 failure.

wrlssqi commented 6 years ago

然后将同步目录改回C:\Users\wrlss\OneDrive\RimeSync,则又无法合并其余id目录的词库了,日志里没有merging出现。 Log file created at: 2018/04/09 21:38:50 Running on machine: DESKTOP-1311TS6 Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg I0409 21:38:50.301365 16120 core_module.cc:20] registering core components. I0409 21:38:50.303354 16120 registry.cc:14] registering component: config_builder I0409 21:38:50.303354 16120 registry.cc:14] registering component: config I0409 21:38:50.303354 16120 registry.cc:14] registering component: schema I0409 21:38:50.303354 16120 registry.cc:14] registering component: user_config I0409 21:38:50.303354 16120 dict_module.cc:24] registering components from module 'dict'. I0409 21:38:50.303354 16120 registry.cc:14] registering component: tabledb I0409 21:38:50.303354 16120 registry.cc:14] registering component: stabledb I0409 21:38:50.303354 16120 registry.cc:14] registering component: plain_userdb I0409 21:38:50.303354 16120 registry.cc:14] registering component: userdb I0409 21:38:50.303354 16120 registry.cc:14] registering component: dictionary I0409 21:38:50.303354 16120 registry.cc:14] registering component: reverse_lookup_dictionary I0409 21:38:50.303354 16120 registry.cc:14] registering component: user_dictionary I0409 21:38:50.303354 16120 registry.cc:14] registering component: userdb_recovery_task I0409 21:38:50.303354 16120 levers_module.cc:23] registering components from module 'levers'. I0409 21:38:50.303354 16120 registry.cc:14] registering component: detect_modifications I0409 21:38:50.303354 16120 registry.cc:14] registering component: installation_update I0409 21:38:50.303354 16120 registry.cc:14] registering component: workspace_update I0409 21:38:50.303354 16120 registry.cc:14] registering component: schema_update I0409 21:38:50.303354 16120 registry.cc:14] registering component: config_file_update I0409 21:38:50.303354 16120 registry.cc:14] registering component: prebuild_all_schemas I0409 21:38:50.303354 16120 registry.cc:14] registering component: user_dict_upgrade I0409 21:38:50.303354 16120 registry.cc:14] registering component: cleanup_trash I0409 21:38:50.303354 16120 registry.cc:14] registering component: user_dict_sync I0409 21:38:50.303354 16120 registry.cc:14] registering component: backup_config_files I0409 21:38:50.303354 16120 registry.cc:14] registering component: clean_old_log_files I0409 21:38:50.308979 16120 deployer.cc:114] starting work thread for 3 tasks. I0409 21:38:50.328533 13020 deployer.cc:83] running deployment tasks: I0409 21:38:50.328533 13020 deployment_tasks.cc:80] updating rime installation info. I0409 21:38:50.328533 13020 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\installation.yaml'. I0409 21:38:50.329536 13020 deployment_tasks.cc:98] installation info exists. installation id: 3e2f8018-8658-4b4a-87fc-7c02e539992e I0409 21:38:50.329536 13020 deployment_tasks.cc:106] sync dir: C:/Users/wrlss/OneDrive/RimeSync I0409 21:38:50.329536 13020 deployment_tasks.cc:108] previous distribution: Weasel I0409 21:38:50.329536 13020 deployment_tasks.cc:111] previous distribution version: 0.11.0 I0409 21:38:50.329536 13020 deployment_tasks.cc:114] previous Rime version: 1.3.1 I0409 21:38:50.329536 13020 deployment_tasks.cc:532] backing up config files. I0409 21:38:50.337558 13020 config_data.cc:65] loading config file 'C:\Users\wrlss\AppData\Roaming\Rime\user.yaml'. I0409 21:38:50.342571 13020 deployment_tasks.cc:571] backed up 1 config files to C:/Users/wrlss/OneDrive/RimeSync\3e2f8018-8658-4b4a-87fc-7c02e539992e, 0 failed, 6 up-to-date, 0 skipped. I0409 21:38:50.342571 13020 user_dict_manager.cc:223] synchronizing 1 user dicts. I0409 21:38:50.342571 13020 user_dict_manager.cc:189] synchronize user dict 'luna_pinyin'. I0409 21:38:50.356609 13020 user_db.cc:123] backing up userdb 'luna_pinyin.userdb' to C:/Users/wrlss/OneDrive/RimeSync\3e2f8018-8658-4b4a-87fc-7c02e539992e\luna_pinyin.userdb.txt I0409 21:38:50.357611 13020 tsv.cc:62] writing tsv file: C:/Users/wrlss/OneDrive/RimeSync\3e2f8018-8658-4b4a-87fc-7c02e539992e\luna_pinyin.userdb.txt I0409 21:38:50.493980 13020 level_db.cc:302] closed db 'luna_pinyin.userdb'. I0409 21:38:50.493980 13020 deployer.cc:95] 3 tasks ran: 3 success, 0 failure.

wrlssqi commented 6 years ago

使用C:\Users\wrlss\OneDrive\RimeSync作为同步目录,是因为这是win10下集成的onedrive的目录,可以方便多机同步。而且之前在win10下用过一段时间的osfan修改的prime,同步目录设在onedrive目录里,功能是正常的。

zzColin commented 6 years ago

猜测:会不会和 sync_dir 用了正斜线有关?

wrlssqi commented 6 years ago

用正斜杠是因为,我的同步目录的设置,字符串是用双引号,此时如果用反斜杠,会部署出错。 sync_dir: "C:/Users/wrlss/OneDrive/RimeSync" 又看了一下使用说明,介绍同步功能的例子用的单引号 image 于是改成单引号格式,用反斜杠也能正常工作了。

诡异的是,现在,不论是我用的双引号正斜杠的格式,还是单引号反斜杠的格式,同步目录设置为onedrive目录时,可以正常的合并其它目录的词库了!变量为:小狼毫版本0.11.1,win10 版本1803。

Prcuvu commented 6 years ago

既然问题已经解决,就关闭了。