Very large update requests trigger failure to sync due to revsDiff failure
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 43/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- databases
調査の方向性
issue に示されている api.revsDiff の実装から始め、JSON.stringify が添付ファイルを含む大きなリビジョン差分 payload をどのように処理するかを調べます。大きな batch で失敗を再現し、その後、request path で RangeError を処理するか batch を小さくするにはどうすべきかを判断します。大きな update requests が、同期にサイレントに、または繰り返し失敗しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I've just diagnosed a problem we were having where sometimes our local pouchDB database did not sync to the remote CouchDB. The source of the problem turned out to be due to our use of a very large batch size (1000) combined with a number of large attachments on documents.
The problem occurs in the implementation of revsDiff:
api.revsDiff = adapterFun('revsDiff', async function (req, opts, callback) {
// If no options were given, set the callback to be the second parameter
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
try {
// Get the missing document/revision IDs
const result = await fetchJSON(genDBUrl(host, '_revs_diff'), {
method: 'POST',
body: JSON.stringify(req)
});
callback(null, result.data);
} catch (error) {
callback(error);
}
});
We were seeing the failure of JSON.stringify with our large payload (RangeError: Invalid string length). This meant that the POST request was not sent. PouchDB then went on to try again with the same payload and failed again.
There is most likely an error reported via the appropriate handler but we missed it.
The solution was to reduce the batch size so that the payload of one request was much smaller.
However, I feel that this is something that could be worked around inside PouchDB - perhaps backing off to smaller batches in the case of a RangeError in this function.
Posting here for reference in case others see this issue and in case this can be prioritised for a fix.
- 主要言語
- JavaScript
- スター
- 17.6k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/pouchdb のほかの issue
-
elemMatch throws TypeError: value is null if array has null element対応中かも @henyanagar が 142 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
似ている issue
-
good first issue help wanted
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
modrollstudio/Modroll-Studio-Website#80 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
area: panel enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
GabrielGirardi/ledge#7 ·
-
0. Needs triage 35-feedback bug
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
A-linter
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
oxc-project/oxc#28783 ·
メンテナーはふだん 1 日以内に返信