Tencent / wcdb

WCDB is a cross-platform database framework developed by WeChat.
Other
10.61k stars 1.39k forks source link

About auto checkpoint #1101

Closed zhangzhanzg closed 1 month ago

zhangzhanzg commented 1 month ago

The language of WCDB

Objective-C

The version of WCDB

v2.0.4

The platform of WCDB

iOS

The installation of WCDB

Cocoapods

What's the issue?

Post the outputs or screenshots for errors.

Explain what you want by example or code in English.

In my project, there are WCDB and FMDB. Since WCDB sets SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=0, this causes the auto checkpoint of other databases using FMDB to fail, which causes the wal file to keep increasing. So how should this conflict be handled?

  1. If SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=0 is not set, what impact will it have on WCDB?
  2. If SQLITE_DEFAULT_WAL_AUTOCHECKPOINT = 0 is set, how should the database using FMDB be set to ensure that auto checkpoint is executed successfully? Thanks
Qiuwen-chen commented 1 month ago

You can build wcdb without SQLITE_DEFAULT_WAL_AUTOCHECKPOINT for now. I will give a better solution in the next version.

zhangzhanzg commented 1 month ago

You mean SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=0 can be removed directly from pod_target_xcconfig,WCDB still works fine

Qiuwen-chen commented 1 month ago

You mean SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=0 can be removed directly from pod_target_xcconfig,WCDB still works fine

Yes

zhangzhanzg commented 1 month ago

You mean SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=0 can be removed directly from pod_target_xcconfig,WCDB still works fine

I try to remove SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=0, but it will be compilation error, because AutoCheckpointConfig::invoke use SQLITE_DEFAULT_WAL_AUTOCHECKPOINT. So I set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000, For better performance, Do I need to set PRAGMA wal_autocheckpoint=0 for my WCDB database? Thanks.

Qiuwen-chen commented 1 month ago

set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000,

It is ok to set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000. PRAGMA config is not needed.

zhangzhanzg commented 1 month ago

set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000,

It is ok to set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000. PRAGMA config is not needed.

Get it, thanks。Are there any other configurations like SQLITE_DEFAULT_WAL_AUTOCHECKPOINT that can be removed or set to default value?

Qiuwen-chen commented 1 month ago

set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000,

It is ok to set SQLITE_DEFAULT_WAL_AUTOCHECKPOINT=1000. PRAGMA config is not needed.

Get it, thanks。Are there any other configurations like SQLITE_DEFAULT_WAL_AUTOCHECKPOINT that can be removed or set to default value?

You can remove configs like SQLITE_ENABLE_xxx.

zhangzhanzg commented 1 month ago

ok, thanks vary much