Etherpad-lite: Postgresバックエンド-エラー:列「値」はタイプjsonbですが、式はタイプテキストです

作成日 2020年09月08日  ·  29コメント  ·  ソース: ether/etherpad-lite

バグを説明する
あらゆる種類の挿入を行うときのスキーマの不一致。

エラー:列 "value"はタイプjsonbですが、式はタイプtextです

再現するには
最新のソースとpostgresを使用してください。 v12およびv13で試してみました。

予想される行動
エラーなしで挿入を行うため。

スクリーンショット
etherpad_1 | [2020-09-08 20:37:50.541] [エラー]コンソール-エラー:列 "値"はタイプjsonbですが、式はタイプテキストです
etherpad_1 | Parser.parseErrorMessage(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:278:15)
etherpad_1 | Parser.handlePacket(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:126:29)
etherpad_1 | Parser.parseで(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:39:38)
etherpad_1 | Socket.stream.on(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/index.js:8:42)
etherpad_1 | Socket.emitで(events.js:198:13)
etherpad_1 | Socket.EventEmitter.emit(domain.js:448:20)で
etherpad_1 | addChunk(_stream_written.js:288:12)
etherpad_1 | 読み取り可能AddChunk(_stream_読み取り可能.js:269:11)
etherpad_1 | Socket.Readable.push(_stream_written.js:224:10)
etherpad_1 | TCP.onStreamReadで[onreadとして](internal / stream_base_commons.js:94:17)

デスクトップ(次の情報を入力してください):
NA

スマートフォン(以下の情報を入力してください):
NA

追加のコンテキスト
これは、Dockerコンテナーでテストされました。

Serious Bug

最も参考になるコメント

@JohnMcLearに感謝します。以下を実行すると、再び機能します。

alter table "store" alter column "value" type text;

全てのコメント29件

これは主に、リリースを使用する必要があるときに最新のソースを使用した場合の問題です。

1.8.4でこれを試しましたが、このエラーが発生しないことを確認できます。 それに応じて問題を更新しました。

1.8.5を除いて、このバグが含まれているので、おっと。

c8361a211a1e6bfbbc006933f48d48ca51857c71で修正済み

c8361a2で修正

私はまだそれを取得します。

image

git pullを実行してからbin / run.shを実行しましたか?

ueberを更新する必要があり、bin /run.shがそれを行います。 fastrunを使用しないでください

ええ、私はいつもbin/run.sh思いつきます。
"ueberdb2": "^0.5.2"更新されます

Screenshot_20200910_103721

テストは問題なく合格しています。

新しいpgdB plzを試すことができますか? 以前のコミットでデータベースが壊れたかどうかを確認したいと思います。

新しいpgdB plzを試すことができますか? 以前のコミットでデータベースが壊れたかどうかを確認したいと思います。

確かに、やってみましょう。

新しいpgdB plzを試すことができますか? 以前のコミットでデータベースが壊れたかどうかを確認したいと思います。

実際、私の開発環境のために、ビルドごとに新しいpgdbを取得しています。
image
image

次に、Travisの構成を確認して、ueberdbテスト用のデータベースを作成する方法を確認します。 ここにないueberdBリポジトリが必要になります

以下のレポを使用する必要があるようですか?
https://github.com/ether/ueberDB#dirtyref

dirtyrefはマスターにマージされます。 master使用する

こんにちは、私は1.8.5でもこの問題を抱えています。 解決策が見つかるまで、この問題を再度開くことはできますか? (それでそれを見つけるのは簡単です!)
ありがとう!

cc @Gared

リポジトリhttps://github.com/ether/ueberDB (マスター)に変更しても、この問題はまだ発生します

image

こっちも一緒:

  • パッドがロードされていません(永遠の「ロード中…」または502)
  • サーバーは、次の例外を除いて1時間ごとに失敗します。
[2020-09-11 11:36:24.449] [ERROR] console - error: column "value" is of type jsonb but expression is of type text
    at Parser.parseErrorMessage (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:278:15)
    at Parser.handlePacket (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/index.js:8:42)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
[2020-09-11 11:36:24.463] [ERROR] console - TypeError: Cannot read property 'name' of null
    at Client._handleParseComplete (/usr/local/var/etherpad/repo/src/node_modules/pg/lib/client.js:358:26)
    at Connection.emit (events.js:315:20)
    at Connection.EventEmitter.emit (domain.js:483:12)
    at /usr/local/var/etherpad/repo/src/node_modules/pg/lib/connection.js:109:12
    at Parser.parse (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:40:17)
    at Socket.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/index.js:8:42)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
  • OS:Ubuntu 18.04
  • settings.json
{
  "dbSettings" : {
                   "user"    : "etherpad",
                   "host"    : "localhost",
                   "port"    : 5432,
                   "password": "xxx",
                   "database": "etherpad",
                 },
  "padOptions": {
    "noColors":         false,
    "showControls":     true,
    "showChat":         true,
    "showLineNumbers":  true,
    "useMonospaceFont": false,
    "userName":         false,
    "userColor":        false,
    "rtl":              false,
    "alwaysShowChat":   false,
    "chatAndUsers":     false,
    "lang":             "de-de"
  },
  "suppressErrorsInPadText": false,
  "requireSession": false,
  "editOnly": true,
  "sessionNoPassword": false,
  "minify": true,
  "maxAge": 21600,
  "abiword": null,
  "soffice": null,
  "tidyHtml": null,
  "allowUnknownFileEnds": true,
  "requireAuthentication": false,
  "requireAuthorization": false,
  "trustProxy": true,
  "disableIPlogging": true,
  "automaticReconnectionTimeout": 5,
  "users": {
    "admin": {
      "hash": "xxx",
      "is_admin": true
    }
  },
  "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
  "loadTest": false,
  "exposeVersion": false,
  "loglevel": "WARN",
  "logconfig" :
    { "appenders": [
        { "type": "console" }
      ]
    }
}
  • DB:postgresql 10 + 190ubuntu0.1
  • DBスキーマ:
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
CREATE FUNCTION public.ueberdb_insert_or_update(character varying, text) RETURNS void
    LANGUAGE plpgsql
    AS $_$ BEGIN   IF EXISTS( SELECT * FROM store WHERE key = $1 ) THEN     UPDATE store SET value = $2 WHERE key = $1;   ELSE     INSERT INTO store(key,value) VALUES( $1, $2 );   END IF;   RETURN; END; $_$;
ALTER FUNCTION public.ueberdb_insert_or_update(character varying, text) OWNER TO etherpad;
CREATE FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) RETURNS void
    LANGUAGE plpgsql
    AS $_$ BEGIN   IF EXISTS( SELECT * FROM store WHERE key = $1 ) THEN     UPDATE store SET value = $2 WHERE key = $1;   ELSE     INSERT INTO store(key,value) VALUES( $1, $2 );   END IF;   RETURN; END; $_$;
ALTER FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) OWNER TO etherpad;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE public.store (
    key character varying(100) NOT NULL,
    value jsonb NOT NULL
);
ALTER TABLE public.store OWNER TO etherpad;
ALTER TABLE ONLY public.store
    ADD CONSTRAINT store_pkey PRIMARY KEY (key);

私はロールバックの道を進みました。 イーサパッドだけを1.8.4にロールバックしようとしましたが、機能しませんでした。

[2020-09-11 20:55:44.494] [ERROR] console - JSON-PROBLEM:[object Object]
[2020-09-11 20:55:44.495] [ERROR] console - (node:1) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at /opt/etherpad-lite/src/node_modules/ueberdb2/CacheAndBufferLayer.js:169:24
    at Query.<anonymous> (/opt/etherpad-lite/src/node_modules/ueberdb2/postgres_common.js:99:5)
    at Query.handleReadyForQuery (/opt/etherpad-lite/src/node_modules/pg/lib/query.js:128:10)
    at Connection.<anonymous> (/opt/etherpad-lite/src/node_modules/pg/lib/client.js:247:19)
    at Connection.emit (events.js:198:13)
    at Connection.EventEmitter.emit (domain.js:448:20)
    at Socket.<anonymous> (/opt/etherpad-lite/src/node_modules/pg/lib/connection.js:134:12)
    at Socket.emit (events.js:198:13)
    at Socket.EventEmitter.emit (domain.js:448:20)
[2020-09-11 20:55:44.496] [ERROR] console - (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[2020-09-11 20:55:44.496] [ERROR] console - (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

そのため、pgsqlダンプも復元し、1.8.4が再び機能するようになりました(正常に機能していたので、これは実際には驚きではありません)。

理由:1.8.4から1.8.5に、列の値がテキスト型からjsonbに変更されました。
メジャーリリースになるはずです...

適用できる移行スクリプトはありますか?

これらのコミットを元に戻すだけです。 これはすべて私見でうまく処理されませんでした。

変更ログには、1.8.6の「重要:1.8.5のpostgresqlの重大な問題が修正されました」と記載されていますが、アップグレードしても上記の例外が発生します。 サービスの再起動直後に出力されるこれらの例外にも気づきました。

[2020-09-19 17:47:45.482] [ERROR] console - JSON-PROBLEM:[object Object]                                    
[2020-09-19 17:47:45.496] [ERROR] console - (node:30613) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)                                                                         
    at /usr/local/var/etherpad/repo/src/node_modules/ueberdb2/lib/CacheAndBufferLayer.js:169:24
    at Query.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/ueberdb2/databases/postgres_common.js:99:5)
    at Query.handleReadyForQuery (/usr/local/var/etherpad/repo/src/node_modules/pg/lib/query.js:122:12)
    at Client._handleReadyForQuery (/usr/local/var/etherpad/repo/src/node_modules/pg/lib/client.js:281:19)
    at Connection.emit (events.js:315:20)               
    at Connection.EventEmitter.emit (domain.js:483:12)          
    at /usr/local/var/etherpad/repo/src/node_modules/pg/lib/connection.js:109:12          
    at Parser.parse (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:40:17)      
    at Socket.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/index.js:8:42)
[2020-09-19 17:47:45.497] [ERROR] console - (node:30613) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)    
[2020-09-19 17:47:45.497] [ERROR] console - (node:30613) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@ c7hm4rデータベースは変更されましたか? 新しいターブル/データベースを開始する場合、問題はありませんか?

@JohnMcLear空のデータベースでEtherpad1.8.6を再起動すると、新しいスキーマが作成され、例外なく機能しているように見えます。

新しいスキーマを古いスキーマと比較すると、次のようになります。

diff --git a/etherpad_schema.sql b/etherpad_schema_new.sql
index 9baf5f4..ad3c08b 100644
--- a/etherpad_schema.sql
+++ b/etherpad_schema_new.sql
@@ -41,17 +41,6 @@ CREATE FUNCTION public.ueberdb_insert_or_update(character varying, text) RETURNS

 ALTER FUNCTION public.ueberdb_insert_or_update(character varying, text) OWNER TO etherpad;

---
--- Name: ueberdb_insert_or_update_jsonb(character varying, jsonb); Type: FUNCTION; Schema: public; Owner: etherpad
---
-
-CREATE FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) RETURNS void
-    LANGUAGE plpgsql
-    AS $_$ BEGIN   IF EXISTS( SELECT * FROM store WHERE key = $1 ) THEN     UPDATE store SET value = $2 WHERE key = $1;   ELSE     INSERT INTO store(key,value) VALUES( $1, $2 );   END IF;   RETURN; END; $_$;
-
-
-ALTER FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) OWNER TO etherpad;
-
 SET default_tablespace = '';

 SET default_with_oids = false;
@@ -62,7 +51,7 @@ SET default_with_oids = false;

 CREATE TABLE public.store (
     key character varying(100) NOT NULL,
-    value jsonb NOT NULL
+    value text NOT NULL
 );

したがって、問題は、列のタイプがいつ変更され、それをどのように移行/元に戻すかということです。

マスターブランチからEtherpadインスタンスの自動更新を構成しました。

@ c7hm4r @qsuscsは、問題のあるコミットの作成者でした。 彼がここで何らかの責任を負い、助けてくれることを願っています:)

https://github.com/ether/ueberDB/commit/b9e786e2c8753f4cbbe09d3695a92a1a03904ead#diff-f1b8245dd259fa912c33cb2db527f609R31はalterステートメントです。

  var updateValueColumnType = "ALTER TABLE store " +
    "ALTER COLUMN value " +
    "TYPE jsonb " +
    "USING value::jsonb";

jsonbをテキストに変更することでそれができると思いますか?

@JohnMcLearに感謝します。以下を実行すると、再び機能します。

alter table "store" alter column "value" type text;

@ c7hm4r心配ありません。うまくいけば、これが影響する少数の人々がこのスレッドを見つけてそのコマンドを実行します。、書き込みとテストに感謝します! :)あなたや原作者が望むなら、私は修正するためにPRを喜んで受けます。 現在、優先している他のタスクがあります。

このページは役に立ちましたか?
0 / 5 - 0 評価