Skip to content

Commit

Permalink
WalLevel for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Safonov committed Jul 20, 2022
1 parent c8ece64 commit deaf5ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions format/postgres/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ var DBState = scalar.UToScalar{
5: {Sym: "DB_IN_ARCHIVE_RECOVERY"},
6: {Sym: "DB_IN_PRODUCTION"},
}

//typedef enum WalLevel
//{
// WAL_LEVEL_MINIMAL = 0,
// WAL_LEVEL_REPLICA,
// WAL_LEVEL_LOGICAL
//} WalLevel;
var WalLevel = scalar.SToScalar{
0: {Sym: "WAL_LEVEL_MINIMAL"},
1: {Sym: "WAL_LEVEL_REPLICA"},
2: {Sym: "WAL_LEVEL_LOGICAL"},
}
2 changes: 1 addition & 1 deletion format/postgres/flavours/pgproee14/pg_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func DecodePgControl(d *decode.D, in any) any {
/* 204 | 4 */ // int wal_level;
/* 208 | 1 */ // _Bool wal_log_hints;
/* XXX 3-byte hole */
d.FieldS32("wal_level")
d.FieldS32("wal_level", common.WalLevel)
d.FieldU8("wal_log_hints")
d.U24()

Expand Down
2 changes: 1 addition & 1 deletion format/postgres/flavours/postgres11/pg_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func DecodePgControl(d *decode.D, in any) any {
/* 164 | 4 */ // int wal_level;
/* 168 | 1 */ // _Bool wal_log_hints;
/* XXX 3-byte hole */
d.FieldS32("wal_level")
d.FieldS32("wal_level", common.WalLevel)
d.FieldU8("wal_log_hints")
d.U24()

Expand Down
2 changes: 1 addition & 1 deletion format/postgres/flavours/postgres14/pg_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func DecodePgControl(d *decode.D, in any) any {
/* 172 | 4 */ // int wal_level;
/* 176 | 1 */ // _Bool wal_log_hints;
/* XXX 3-byte hole */
d.FieldS32("wal_level")
d.FieldS32("wal_level", common.WalLevel)
d.FieldU8("wal_log_hints")
d.U24()

Expand Down

0 comments on commit deaf5ef

Please sign in to comment.