Skip to content

Commit

Permalink
Merge pull request yugabyte#18 from dvarrazzo/better-defaults
Browse files Browse the repository at this point in the history
Better defaults
  • Loading branch information
Euler Taveira de Oliveira authored May 10, 2017
2 parents badf199 + 8a99319 commit 820c1ff
Show file tree
Hide file tree
Showing 30 changed files with 198 additions and 147 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,16 @@ The output in the first terminal is:

```
{
"xid": 34225,
"change": [
]
}
{
"xid": 34226,
"change": [
]
}
WARNING: table "table_without_pk" without primary key or replica identity is nothing
CONTEXTO: slot "test_slot", output plugin "wal2json", in the change callback, associated LSN 0/126E5F70
{
"xid": 34227,
"change": [
{
"kind": "insert",
Expand Down Expand Up @@ -241,7 +238,6 @@ COMMIT
psql:/tmp/example2.sql:17: WARNING: table "table_without_pk" without primary key or replica identity is nothing
CONTEXTO: slot "test_slot", output plugin "wal2json", in the change callback, associated LSN 0/12713E40
{
"xid": 34232,
"change": [
{
"kind": "insert",
Expand Down
16 changes: 8 additions & 8 deletions expected/bytea.out

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions expected/cmdline.out
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,46 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'wal2js

SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'nosuchopt', '42');
ERROR: option "nosuchopt" = "42" is unknown
-- By default don't write in chunks
CREATE TABLE x ();
DROP TABLE x;
SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', 'f');
data
---------------
{"change":[]}
{"change":[]}
(2 rows)

SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', 'f', 'write-in-chunks', 't');
data
-------------
{"change":[
]}
{"change":[
]}
(4 rows)

-- By default don't write xids
CREATE TABLE gimmexid (id integer PRIMARY KEY);
INSERT INTO gimmexid values (1);
DROP TABLE gimmexid;
SELECT max(((data::json) -> 'xid')::text::int) < txid_current() FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '1');
?column?
----------
t
(1 row)

SELECT max(((data::json) -> 'xid')::text::int) + 10 > txid_current() FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '1');
?column?
----------
t
(1 row)

SELECT data FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL) where ((data::json) -> 'xid') IS NOT NULL;
data
------
(0 rows)

SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');
?column?
----------
Expand Down
12 changes: 6 additions & 6 deletions expected/delete1.out
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ DELETE FROM table_without_pk WHERE b = 1;
DELETE FROM table_with_pk WHERE b = 1;
-- DELETE: unique
DELETE FROM table_with_unique WHERE b = 1;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
WARNING: table "table_without_pk" without primary key or replica identity is nothing
WARNING: table "table_with_unique" without primary key or replica identity is nothing
data
-----------------------------------------------------------------------
{ +
"change": [
"change": [ +
] +
}
{ +
"change": [
"change": [ +
{ +
"kind": "delete", +
"schema": "public", +
Expand All @@ -96,14 +96,14 @@ WARNING: table "table_with_unique" without primary key or replica identity is n
"keytypes": ["int2", "int4", "int8"],+
"keyvalues": [1, 2, 3] +
} +
}
} +
] +
}
{ +
"change": [
"change": [ +
] +
}
(7 rows)
(3 rows)

SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');
?column?
Expand Down
22 changes: 11 additions & 11 deletions expected/delete2.out
Original file line number Diff line number Diff line change
Expand Up @@ -80,49 +80,49 @@ ALTER TABLE table_without_pk REPLICA IDENTITY DEFAULT;
ALTER TABLE table_with_unique REPLICA IDENTITY NOTHING;
DELETE FROM table_with_unique WHERE b = 1;
ALTER TABLE table_with_unique REPLICA IDENTITY DEFAULT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
WARNING: table "table_with_pk" without primary key or replica identity is nothing
WARNING: table "table_without_pk" without primary key or replica identity is nothing
WARNING: table "table_with_unique" without primary key or replica identity is nothing
data
---------------------
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
{ +
"change": [
"change": [+
] +
}
(18 rows)
(9 rows)

SELECT 'stop' FROM pg_drop_replication_slot('regression_slot');
?column?
Expand Down
Loading

0 comments on commit 820c1ff

Please sign in to comment.