Records are dumped without retry when PostgreSQL temporarily shuts down during insertion
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
調査の方向性
まず、挿入中にPostgreSQLを停止した状態で、提供されたFluentd tailおよびSQL outputの設定を使って失敗を再現します。SQL outputクラスがActiveRecord::StatementInvalidをどのように分類し、dumpとretryのどちらを選択するかを追跡します。一時的なPostgreSQLのシャットダウンによって、すべてのレコードがdumpされるのではなく、後でretryできるよう保持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I have an input file containing about 400k lines, one JSON entry per line, read using the tail input, and I am using SQL output into Postgres. In normal conditions all entries are properly inserted.
However I need to make sure that a sudden stop of PostgreSQL will not lead to a loss of records by Fluentd and that these records will be retried. When I tried stopping PostgreSQL at a random moment during the insertion, about 9k entries were dumped because the plugin classified these errors as "deterministic errors":
2023-09-13 19:09:51 +0200 [warn]: #0 Got deterministic error. Fallback to one-by-one import error_class=ActiveRecord::StatementInvalid error="PG::ConnectionBad: PQconsumeInput() FATAL: terminating connection due to administrator command\nSSL connection has been closed unexpectedly\n"
2023-09-13 19:09:51 +0200 [error]: #0 Got deterministic error again. Dump a record error_class=ActiveRecord::StatementInvalid error="PG::ConnectionBad: PQsocket() can't get socket descriptor" record=#<Fluent::Plugin::SQLOutput::BaseModel_506070496::AccessLog […]>
and 9k more Got deterministic error again messages with a dump of the record. After that, the Postgres connection error was detected and the plugin retried as it should until Postgres comes back up, and the rest of the records are inserted but the dumped ones are lost.
The behaviour I expect is that no records should be dumped in case Postgres is temporarily stopped.
This is my configuration:
<match td.*.*>
@type sql
adapter postgresql
host localhost
port 5432
database fluentd
username fluentd
password supersecretpasswd
<table>
table access_logs
column_mapping '@timestamp:timestamp,action,api_version,host,method,path,route,controller,duration,status,ip,source,retriever_cached:cached,token_id,parameters:params,request_id'
</table>
</match>
<source>
@type tail
@id input_tail
<parse>
@type json
</parse>
path /path/to/input.json
pos_file /path/to/input.json.pos
tag td.foo.bla
</source>
Packages versions:
$ fluentd --version
fluent-package 5.0.1 fluentd 1.16.2 (d5685ada81ac89a35a79965f1e94bbe5952a5d3a)
$ fluent-gem list|grep sql
fluent-plugin-sql (2.3.0)
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.3 LTS"
- 主要言語
- Ruby
- スター
- 112
- フォーク
- 58
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fluent/fluent-plugin-sql のほかの issue
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
fluent/fluent-plugin-sql#151 · コメント 1 件 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
fluent/fluent-plugin-sql#149 ·
-
bug needs-investigation
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
fluent/fluent-plugin-sql#141 · コメント 1 件 ·
-
fluent/fluent-plugin-sql#134 · コメント 6 件 · 担当者 1 名 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
fluent/fluent-plugin-sql#133 · コメント 2 件 ·
fluent/fluent-plugin-sql の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
palladius/rails8-app-on-gcp#145 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
riscv/riscv-unified-db#2624 · リアクション 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100