mirror of
https://github.com/wader/fq.git
synced 2024-12-27 15:42:07 +03:00
postgres: fix compilation, fix tests
This commit is contained in:
parent
bb2659d442
commit
e5f15c5fed
@ -126,6 +126,9 @@ ogg_page OGG page
|
|||||||
opus_packet Opus packet
|
opus_packet Opus packet
|
||||||
pcap PCAP packet capture
|
pcap PCAP packet capture
|
||||||
pcapng PCAPNG packet capture
|
pcapng PCAPNG packet capture
|
||||||
|
pg_btree PostgreSQL btree index file
|
||||||
|
pg_control PostgreSQL control file
|
||||||
|
pg_heap PostgreSQL heap file
|
||||||
png Portable Network Graphics file
|
png Portable Network Graphics file
|
||||||
prores_frame Apple ProRes frame
|
prores_frame Apple ProRes frame
|
||||||
protobuf Protobuf
|
protobuf Protobuf
|
||||||
|
@ -112,9 +112,9 @@ var (
|
|||||||
Opus_Packet = &decode.Group{Name: "opus_packet"}
|
Opus_Packet = &decode.Group{Name: "opus_packet"}
|
||||||
PCAP = &decode.Group{Name: "pcap"}
|
PCAP = &decode.Group{Name: "pcap"}
|
||||||
PCAPNG = &decode.Group{Name: "pcapng"}
|
PCAPNG = &decode.Group{Name: "pcapng"}
|
||||||
PG_BTREE = "pg_btree"
|
PG_BTREE = &decode.Group{Name: "pg_btree"}
|
||||||
PG_CONTROL = "pg_control"
|
PG_CONTROL = &decode.Group{Name: "pg_control"}
|
||||||
PG_HEAP = "pg_heap"
|
PG_HEAP = &decode.Group{Name: "pg_heap"}
|
||||||
PNG = &decode.Group{Name: "png"}
|
PNG = &decode.Group{Name: "png"}
|
||||||
Prores_Frame = &decode.Group{Name: "prores_frame"}
|
Prores_Frame = &decode.Group{Name: "prores_frame"}
|
||||||
Protobuf = &decode.Group{Name: "protobuf"}
|
Protobuf = &decode.Group{Name: "protobuf"}
|
||||||
|
@ -272,7 +272,7 @@ func decodeIndexTuples(btree *BTree, d *decode.D) {
|
|||||||
d.FieldValueBool("has_nulls", hasNulls)
|
d.FieldValueBool("has_nulls", hasNulls)
|
||||||
d.FieldValueBool("has_var_widths", hasVarWidths)
|
d.FieldValueBool("has_var_widths", hasVarWidths)
|
||||||
})
|
})
|
||||||
d.FieldValueU("size", size)
|
d.FieldValueUint("size", size)
|
||||||
if size < IndexTupleDataSize {
|
if size < IndexTupleDataSize {
|
||||||
d.Fatalf("invalid size of tuple = %d\n", size)
|
d.Fatalf("invalid size of tuple = %d\n", size)
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// typedef enum DBState
|
// typedef enum DBState
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// DB_STARTUP = 0,
|
// DB_STARTUP = 0,
|
||||||
// DB_SHUTDOWNED,
|
// DB_SHUTDOWNED,
|
||||||
@ -18,7 +19,7 @@ import (
|
|||||||
// DB_IN_ARCHIVE_RECOVERY,
|
// DB_IN_ARCHIVE_RECOVERY,
|
||||||
// DB_IN_PRODUCTION
|
// DB_IN_PRODUCTION
|
||||||
// } DBState;
|
// } DBState;
|
||||||
var DBState = scalar.UToScalar{
|
var DBState = scalar.UintMap{
|
||||||
0: {Sym: "DB_STARTUP"},
|
0: {Sym: "DB_STARTUP"},
|
||||||
1: {Sym: "DB_SHUTDOWNED"},
|
1: {Sym: "DB_SHUTDOWNED"},
|
||||||
2: {Sym: "DB_SHUTDOWNED_IN_RECOVERY"},
|
2: {Sym: "DB_SHUTDOWNED_IN_RECOVERY"},
|
||||||
@ -29,12 +30,13 @@ var DBState = scalar.UToScalar{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// typedef enum WalLevel
|
// typedef enum WalLevel
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// WAL_LEVEL_MINIMAL = 0,
|
// WAL_LEVEL_MINIMAL = 0,
|
||||||
// WAL_LEVEL_REPLICA,
|
// WAL_LEVEL_REPLICA,
|
||||||
// WAL_LEVEL_LOGICAL
|
// WAL_LEVEL_LOGICAL
|
||||||
// } WalLevel;
|
// } WalLevel;
|
||||||
var WalLevel = scalar.SToScalar{
|
var WalLevel = scalar.SintMap{
|
||||||
0: {Sym: "WAL_LEVEL_MINIMAL"},
|
0: {Sym: "WAL_LEVEL_MINIMAL"},
|
||||||
1: {Sym: "WAL_LEVEL_REPLICA"},
|
1: {Sym: "WAL_LEVEL_REPLICA"},
|
||||||
2: {Sym: "WAL_LEVEL_LOGICAL"},
|
2: {Sym: "WAL_LEVEL_LOGICAL"},
|
||||||
@ -42,8 +44,9 @@ var WalLevel = scalar.SToScalar{
|
|||||||
|
|
||||||
type icuVersionMapper struct{}
|
type icuVersionMapper struct{}
|
||||||
|
|
||||||
func (m icuVersionMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m icuVersionMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
a := s.ActualU()
|
s.ScalarActual()
|
||||||
|
a := s.Actual
|
||||||
major := a & 0xff
|
major := a & 0xff
|
||||||
minor := (a >> 8) & 0xff
|
minor := (a >> 8) & 0xff
|
||||||
v1 := (a >> 16) & 0xff
|
v1 := (a >> 16) & 0xff
|
||||||
@ -56,8 +59,8 @@ var IcuVersionMapper = icuVersionMapper{}
|
|||||||
|
|
||||||
type xLogRecPtrMapper struct{}
|
type xLogRecPtrMapper struct{}
|
||||||
|
|
||||||
func (m xLogRecPtrMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m xLogRecPtrMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
v := s.ActualU()
|
v := s.Actual
|
||||||
s.Sym = fmt.Sprintf("%X/%X", v>>32, uint32(v))
|
s.Sym = fmt.Sprintf("%X/%X", v>>32, uint32(v))
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
@ -67,8 +70,8 @@ var LocPtrMapper = xLogRecPtrMapper{}
|
|||||||
|
|
||||||
type nextFullXidMapper struct{}
|
type nextFullXidMapper struct{}
|
||||||
|
|
||||||
func (m nextFullXidMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m nextFullXidMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
v := s.ActualU()
|
v := s.Actual
|
||||||
s.Sym = fmt.Sprintf("%d:%d", v>>32, uint32(v))
|
s.Sym = fmt.Sprintf("%d:%d", v>>32, uint32(v))
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
@ -77,8 +80,8 @@ var NextFullXidMapper = nextFullXidMapper{}
|
|||||||
|
|
||||||
type timeMapper struct{}
|
type timeMapper struct{}
|
||||||
|
|
||||||
func (m timeMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m timeMapper) MapSint(s scalar.Sint) (scalar.Sint, error) {
|
||||||
ut := s.ActualS()
|
ut := s.Actual
|
||||||
t := time.Unix(ut, 0)
|
t := time.Unix(ut, 0)
|
||||||
s.Sym = t.UTC().Format(time.RFC1123)
|
s.Sym = t.UTC().Format(time.RFC1123)
|
||||||
return s, nil
|
return s, nil
|
||||||
@ -87,12 +90,14 @@ func (m timeMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
|||||||
var TimeMapper = timeMapper{}
|
var TimeMapper = timeMapper{}
|
||||||
|
|
||||||
// typedef enum
|
// typedef enum
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// PG_UNKNOWN = 0xFFFF,
|
// PG_UNKNOWN = 0xFFFF,
|
||||||
// PG_ORIGINAL = 0,
|
// PG_ORIGINAL = 0,
|
||||||
// PGPRO_STANDARD = ('P'<<8|'P'),
|
// PGPRO_STANDARD = ('P'<<8|'P'),
|
||||||
// PGPRO_ENTERPRISE = ('P'<<8|'E'),
|
// PGPRO_ENTERPRISE = ('P'<<8|'E'),
|
||||||
// } PgEdition;
|
// } PgEdition;
|
||||||
|
//
|
||||||
//nolint:revive
|
//nolint:revive
|
||||||
const (
|
const (
|
||||||
PG_UNKNOWN = 0xFFFF
|
PG_UNKNOWN = 0xFFFF
|
||||||
@ -108,8 +113,8 @@ const (
|
|||||||
|
|
||||||
type versionMapper struct{}
|
type versionMapper struct{}
|
||||||
|
|
||||||
func (m versionMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m versionMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
v := s.ActualU()
|
v := s.Actual
|
||||||
v1, v2 := ParsePgProVersion(uint32(v))
|
v1, v2 := ParsePgProVersion(uint32(v))
|
||||||
switch v1 {
|
switch v1 {
|
||||||
case PG_UNKNOWN:
|
case PG_UNKNOWN:
|
||||||
@ -134,8 +139,8 @@ func ParsePgProVersion(v uint32) (pgProVersion uint32, oriVer uint32) {
|
|||||||
|
|
||||||
type hexMapper struct{}
|
type hexMapper struct{}
|
||||||
|
|
||||||
func (m hexMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m hexMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
v := s.ActualU()
|
v := s.Actual
|
||||||
s.Sym = fmt.Sprintf("%X", v)
|
s.Sym = fmt.Sprintf("%X", v)
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ func TransactionIDIsNormal(xid uint64) bool {
|
|||||||
|
|
||||||
type lpFlagsMapper struct{}
|
type lpFlagsMapper struct{}
|
||||||
|
|
||||||
func (m lpFlagsMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m lpFlagsMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
switch s.ActualU() {
|
switch s.Actual {
|
||||||
case LP_UNUSED:
|
case LP_UNUSED:
|
||||||
s.Sym = "LP_UNUSED"
|
s.Sym = "LP_UNUSED"
|
||||||
case LP_NORMAL:
|
case LP_NORMAL:
|
||||||
@ -41,8 +41,8 @@ type Mask struct {
|
|||||||
Mask uint64
|
Mask uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m Mask) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m Mask) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
m1 := s.ActualU()
|
m1 := s.Actual
|
||||||
v := IsMaskSet(m1, m.Mask)
|
v := IsMaskSet(m1, m.Mask)
|
||||||
s.Actual = v
|
s.Actual = v
|
||||||
return s, nil
|
return s, nil
|
||||||
|
@ -92,9 +92,9 @@ func decodeItemIdsInternal(page *HeapPage, d *decode.D) {
|
|||||||
itemID.Flags = uint32((itemIDData >> 15) & 0x3)
|
itemID.Flags = uint32((itemIDData >> 15) & 0x3)
|
||||||
itemID.Len = uint32((itemIDData >> 17) & 0x7fff)
|
itemID.Len = uint32((itemIDData >> 17) & 0x7fff)
|
||||||
|
|
||||||
d.FieldValueU("lp_off", uint64(itemID.Off))
|
d.FieldValueUint("lp_off", uint64(itemID.Off))
|
||||||
d.FieldValueU("lp_flags", uint64(itemID.Flags), common.LpFlagsMapper)
|
d.FieldValueUint("lp_flags", uint64(itemID.Flags), common.LpFlagsMapper)
|
||||||
d.FieldValueU("lp_len", uint64(itemID.Len))
|
d.FieldValueUint("lp_len", uint64(itemID.Len))
|
||||||
|
|
||||||
page.ItemIds = append(page.ItemIds, itemID)
|
page.ItemIds = append(page.ItemIds, itemID)
|
||||||
})
|
})
|
||||||
|
@ -183,7 +183,7 @@ func decodeHeapPage(heap *Heap, d *decode.D, blockNumber uint32) {
|
|||||||
d.FieldStruct("page_header", func(d *decode.D) {
|
d.FieldStruct("page_header", func(d *decode.D) {
|
||||||
heap.DecodePageHeaderData(page, d)
|
heap.DecodePageHeaderData(page, d)
|
||||||
|
|
||||||
d.FieldValueU("pd_checksum_check", uint64(checkSum))
|
d.FieldValueUint("pd_checksum_check", uint64(checkSum))
|
||||||
sumEqual := page.PdChecksum == checkSum
|
sumEqual := page.PdChecksum == checkSum
|
||||||
d.FieldValueBool("pd_checksum_check_equal", sumEqual)
|
d.FieldValueBool("pd_checksum_check_equal", sumEqual)
|
||||||
})
|
})
|
||||||
@ -398,8 +398,8 @@ type TransactionMapper struct {
|
|||||||
Tuple *TupleD
|
Tuple *TupleD
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m TransactionMapper) MapScalar(s scalar.S) (scalar.S, error) {
|
func (m TransactionMapper) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||||
xid := s.ActualU()
|
xid := s.Actual
|
||||||
|
|
||||||
if m.Special.PdXidBase != 0 && m.Tuple.IsMulti && common.TransactionIDIsNormal(xid) {
|
if m.Special.PdXidBase != 0 && m.Tuple.IsMulti && common.TransactionIDIsNormal(xid) {
|
||||||
xid64 := xid + m.Special.PdXidBase
|
xid64 := xid + m.Special.PdXidBase
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/wader/fq/pkg/scalar"
|
"github.com/wader/fq/pkg/scalar"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
d.FieldU64("system_identifier")
|
d.FieldU64("system_identifier")
|
||||||
d.FieldU32("pg_control_version", common.VersionMapper)
|
d.FieldU32("pg_control_version", common.VersionMapper)
|
||||||
d.FieldU32("catalog_version_no")
|
d.FieldU32("catalog_version_no")
|
||||||
|
@ -76,7 +76,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 80 */
|
/* total size (bytes): 80 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -76,7 +76,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 88 */
|
/* total size (bytes): 88 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -74,7 +74,7 @@ import (
|
|||||||
/* XXX 4-byte padding */
|
/* XXX 4-byte padding */
|
||||||
|
|
||||||
/* total size (bytes): 88 */
|
/* total size (bytes): 88 */
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -74,7 +74,7 @@ import (
|
|||||||
/* XXX 4-byte padding */
|
/* XXX 4-byte padding */
|
||||||
//
|
//
|
||||||
/* total size (bytes): 88 */
|
/* total size (bytes): 88 */
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -80,7 +80,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 120 */
|
/* total size (bytes): 120 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -81,7 +81,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 120 */
|
/* total size (bytes): 120 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -81,7 +81,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 120 */
|
/* total size (bytes): 120 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -78,7 +78,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 120 */
|
/* total size (bytes): 120 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -78,7 +78,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 120 */
|
/* total size (bytes): 120 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -76,7 +76,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 120 */
|
/* total size (bytes): 120 */
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -78,7 +78,7 @@ import (
|
|||||||
/* total size (bytes): 80 */
|
/* total size (bytes): 80 */
|
||||||
//
|
//
|
||||||
|
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -76,7 +76,7 @@ import (
|
|||||||
//
|
//
|
||||||
/* total size (bytes): 80 */
|
/* total size (bytes): 80 */
|
||||||
//
|
//
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -75,7 +75,7 @@ import (
|
|||||||
/* XXX 4-byte padding */
|
/* XXX 4-byte padding */
|
||||||
//
|
//
|
||||||
/* total size (bytes): 88 */
|
/* total size (bytes): 88 */
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -74,7 +74,7 @@ import (
|
|||||||
/* XXX 4-byte padding */
|
/* XXX 4-byte padding */
|
||||||
//
|
//
|
||||||
/* total size (bytes): 88 */
|
/* total size (bytes): 88 */
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -74,7 +74,7 @@ import (
|
|||||||
/* XXX 4-byte padding */
|
/* XXX 4-byte padding */
|
||||||
//
|
//
|
||||||
/* total size (bytes): 88 */
|
/* total size (bytes): 88 */
|
||||||
func DecodePgControl(d *decode.D, in any) any {
|
func DecodePgControl(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
/* 12 | 4 */ // uint32 catalog_version_no;
|
/* 12 | 4 */ // uint32 catalog_version_no;
|
||||||
|
@ -14,11 +14,10 @@ import (
|
|||||||
var pgBTreeFS embed.FS
|
var pgBTreeFS embed.FS
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
interp.RegisterFormat(decode.Format{
|
interp.RegisterFormat(format.PG_BTREE, &decode.Format{
|
||||||
Name: format.PG_BTREE,
|
|
||||||
Description: "PostgreSQL btree index file",
|
Description: "PostgreSQL btree index file",
|
||||||
DecodeFn: decodePgBTree,
|
DecodeFn: decodePgBTree,
|
||||||
DecodeInArg: format.PostgresBTreeIn{
|
DefaultInArg: format.PostgresBTreeIn{
|
||||||
Page: 0,
|
Page: 0,
|
||||||
},
|
},
|
||||||
RootArray: true,
|
RootArray: true,
|
||||||
@ -27,10 +26,10 @@ func init() {
|
|||||||
interp.RegisterFS(pgBTreeFS)
|
interp.RegisterFS(pgBTreeFS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodePgBTree(d *decode.D, in any) any {
|
func decodePgBTree(d *decode.D) any {
|
||||||
d.Endian = decode.LittleEndian
|
d.Endian = decode.LittleEndian
|
||||||
pgIn, ok := in.(format.PostgresBTreeIn)
|
var pgIn format.PostgresBTreeIn
|
||||||
if !ok {
|
if !d.ArgAs(&pgIn) {
|
||||||
d.Fatalf("DecodeInArg must be PostgresBTreeIn!\n")
|
d.Fatalf("DecodeInArg must be PostgresBTreeIn!\n")
|
||||||
}
|
}
|
||||||
return postgres.DecodePgBTree(d, pgIn)
|
return postgres.DecodePgBTree(d, pgIn)
|
||||||
|
@ -29,11 +29,10 @@ import (
|
|||||||
var pgControlFS embed.FS
|
var pgControlFS embed.FS
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
interp.RegisterFormat(decode.Format{
|
interp.RegisterFormat(format.PG_CONTROL, &decode.Format{
|
||||||
Name: format.PG_CONTROL,
|
|
||||||
Description: "PostgreSQL control file",
|
Description: "PostgreSQL control file",
|
||||||
DecodeFn: decodePgControl,
|
DecodeFn: decodePgControl,
|
||||||
DecodeInArg: format.PostgresIn{
|
DefaultInArg: format.PostgresIn{
|
||||||
Flavour: "",
|
Flavour: "",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -72,55 +71,55 @@ const (
|
|||||||
PG_FLAVOUR_PGPROEE15 = "pgproee15"
|
PG_FLAVOUR_PGPROEE15 = "pgproee15"
|
||||||
)
|
)
|
||||||
|
|
||||||
func decodePgControl(d *decode.D, in any) any {
|
func decodePgControl(d *decode.D) any {
|
||||||
d.Endian = decode.LittleEndian
|
d.Endian = decode.LittleEndian
|
||||||
|
|
||||||
pgIn, ok := in.(format.PostgresIn)
|
var pgIn format.PostgresIn
|
||||||
if !ok {
|
if !d.ArgAs(&pgIn) {
|
||||||
d.Fatalf("DecodeInArg must be PostgresIn!\n")
|
d.Fatalf("DecodeInArg must be PostgresIn!\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch pgIn.Flavour {
|
switch pgIn.Flavour {
|
||||||
case PG_FLAVOUR_POSTGRES10:
|
case PG_FLAVOUR_POSTGRES10:
|
||||||
return postgres10.DecodePgControl(d, in)
|
return postgres10.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_POSTGRES11:
|
case PG_FLAVOUR_POSTGRES11:
|
||||||
return postgres11.DecodePgControl(d, in)
|
return postgres11.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_POSTGRES12:
|
case PG_FLAVOUR_POSTGRES12:
|
||||||
return postgres12.DecodePgControl(d, in)
|
return postgres12.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_POSTGRES13:
|
case PG_FLAVOUR_POSTGRES13:
|
||||||
return postgres13.DecodePgControl(d, in)
|
return postgres13.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_POSTGRES14, PG_FLAVOUR_POSTGRES15, PG_FLAVOUR_PGPRO15:
|
case PG_FLAVOUR_POSTGRES14, PG_FLAVOUR_POSTGRES15, PG_FLAVOUR_PGPRO15:
|
||||||
return postgres14.DecodePgControl(d, in)
|
return postgres14.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPRO10:
|
case PG_FLAVOUR_PGPRO10:
|
||||||
return pgpro10.DecodePgControl(d, in)
|
return pgpro10.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPRO11:
|
case PG_FLAVOUR_PGPRO11:
|
||||||
return pgpro11.DecodePgControl(d, in)
|
return pgpro11.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPRO12:
|
case PG_FLAVOUR_PGPRO12:
|
||||||
return pgpro12.DecodePgControl(d, in)
|
return pgpro12.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPRO13:
|
case PG_FLAVOUR_PGPRO13:
|
||||||
return pgpro13.DecodePgControl(d, in)
|
return pgpro13.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPRO14:
|
case PG_FLAVOUR_PGPRO14:
|
||||||
return pgpro14.DecodePgControl(d, in)
|
return pgpro14.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPROEE10:
|
case PG_FLAVOUR_PGPROEE10:
|
||||||
return pgproee10.DecodePgControl(d, in)
|
return pgproee10.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPROEE11:
|
case PG_FLAVOUR_PGPROEE11:
|
||||||
return pgproee11.DecodePgControl(d, in)
|
return pgproee11.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPROEE12:
|
case PG_FLAVOUR_PGPROEE12:
|
||||||
return pgproee12.DecodePgControl(d, in)
|
return pgproee12.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPROEE13:
|
case PG_FLAVOUR_PGPROEE13:
|
||||||
return pgproee13.DecodePgControl(d, in)
|
return pgproee13.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPROEE14:
|
case PG_FLAVOUR_PGPROEE14:
|
||||||
return pgproee14.DecodePgControl(d, in)
|
return pgproee14.DecodePgControl(d)
|
||||||
case PG_FLAVOUR_PGPROEE15:
|
case PG_FLAVOUR_PGPROEE15:
|
||||||
return pgproee15.DecodePgControl(d, in)
|
return pgproee15.DecodePgControl(d)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return probeForDecode(d, in)
|
return probeForDecode(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
func probeForDecode(d *decode.D, in any) any {
|
func probeForDecode(d *decode.D) any {
|
||||||
/* 0 | 8 */ // uint64 system_identifier;
|
/* 0 | 8 */ // uint64 system_identifier;
|
||||||
/* 8 | 4 */ // uint32 pg_control_version;
|
/* 8 | 4 */ // uint32 pg_control_version;
|
||||||
d.U64()
|
d.U64()
|
||||||
@ -132,39 +131,39 @@ func probeForDecode(d *decode.D, in any) any {
|
|||||||
if pgProVersion == common.PG_ORIGINAL {
|
if pgProVersion == common.PG_ORIGINAL {
|
||||||
switch oriVersion {
|
switch oriVersion {
|
||||||
case PG_CONTROL_VERSION_10:
|
case PG_CONTROL_VERSION_10:
|
||||||
return postgres10.DecodePgControl(d, in)
|
return postgres10.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_11:
|
case PG_CONTROL_VERSION_11:
|
||||||
return postgres11.DecodePgControl(d, in)
|
return postgres11.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_12:
|
case PG_CONTROL_VERSION_12:
|
||||||
return postgres12.DecodePgControl(d, in)
|
return postgres12.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_14:
|
case PG_CONTROL_VERSION_14:
|
||||||
return postgres14.DecodePgControl(d, in)
|
return postgres14.DecodePgControl(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if pgProVersion == common.PGPRO_STANDARD {
|
if pgProVersion == common.PGPRO_STANDARD {
|
||||||
switch oriVersion {
|
switch oriVersion {
|
||||||
case PG_CONTROL_VERSION_10:
|
case PG_CONTROL_VERSION_10:
|
||||||
return pgpro10.DecodePgControl(d, in)
|
return pgpro10.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_11:
|
case PG_CONTROL_VERSION_11:
|
||||||
return pgpro11.DecodePgControl(d, in)
|
return pgpro11.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_12:
|
case PG_CONTROL_VERSION_12:
|
||||||
return pgpro12.DecodePgControl(d, in)
|
return pgpro12.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_14:
|
case PG_CONTROL_VERSION_14:
|
||||||
return pgpro14.DecodePgControl(d, in)
|
return pgpro14.DecodePgControl(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if pgProVersion == common.PGPRO_ENTERPRISE {
|
if pgProVersion == common.PGPRO_ENTERPRISE {
|
||||||
switch oriVersion {
|
switch oriVersion {
|
||||||
case PG_CONTROL_VERSION_10:
|
case PG_CONTROL_VERSION_10:
|
||||||
return pgproee10.DecodePgControl(d, in)
|
return pgproee10.DecodePgControl(d)
|
||||||
case PGPRO_CONTROL_VERSION_11:
|
case PGPRO_CONTROL_VERSION_11:
|
||||||
return pgproee11.DecodePgControl(d, in)
|
return pgproee11.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_12:
|
case PG_CONTROL_VERSION_12:
|
||||||
return pgproee12.DecodePgControl(d, in)
|
return pgproee12.DecodePgControl(d)
|
||||||
case PG_CONTROL_VERSION_14:
|
case PG_CONTROL_VERSION_14:
|
||||||
return pgproee14.DecodePgControl(d, in)
|
return pgproee14.DecodePgControl(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,11 +18,10 @@ import (
|
|||||||
var pgHeapFS embed.FS
|
var pgHeapFS embed.FS
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
interp.RegisterFormat(decode.Format{
|
interp.RegisterFormat(format.PG_HEAP, &decode.Format{
|
||||||
Name: format.PG_HEAP,
|
|
||||||
Description: "PostgreSQL heap file",
|
Description: "PostgreSQL heap file",
|
||||||
DecodeFn: decodePgheap,
|
DecodeFn: decodePgheap,
|
||||||
DecodeInArg: format.PostgresHeapIn{
|
DefaultInArg: format.PostgresHeapIn{
|
||||||
Flavour: PG_FLAVOUR_POSTGRES14,
|
Flavour: PG_FLAVOUR_POSTGRES14,
|
||||||
Page: 0,
|
Page: 0,
|
||||||
Segment: 0,
|
Segment: 0,
|
||||||
@ -33,11 +32,11 @@ func init() {
|
|||||||
interp.RegisterFS(pgHeapFS)
|
interp.RegisterFS(pgHeapFS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodePgheap(d *decode.D, in any) any {
|
func decodePgheap(d *decode.D) any {
|
||||||
d.Endian = decode.LittleEndian
|
d.Endian = decode.LittleEndian
|
||||||
|
|
||||||
pgIn, ok := in.(format.PostgresHeapIn)
|
var pgIn format.PostgresHeapIn
|
||||||
if !ok {
|
if !d.ArgAs(&pgIn) {
|
||||||
d.Fatalf("DecodeInArg must be PostgresIn!\n")
|
d.Fatalf("DecodeInArg must be PostgresIn!\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user