Compare commits

...

1 Commits

Author SHA1 Message Date
Konstantin Knizhnik
8799a603a2 walingest createdb record both for CREATE_DATABASE_FROM_WAL and CREATE_DATABASE_FILE_COPY 2023-09-19 13:23:14 +03:00

View File

@@ -151,23 +151,18 @@ impl<'a> WalIngest<'a> {
} }
} }
} else if self.timeline.pg_version == 15 { } else if self.timeline.pg_version == 15 {
if (decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK) match decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK {
== postgres_ffi::v15::bindings::XLOG_DBASE_CREATE_WAL_LOG postgres_ffi::v15::bindings::XLOG_DBASE_CREATE_WAL_LOG
{ | postgres_ffi::v15::bindings::XLOG_DBASE_CREATE_FILE_COPY => {
debug!("XLOG_DBASE_CREATE_WAL_LOG: noop");
} else if (decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK)
== postgres_ffi::v15::bindings::XLOG_DBASE_CREATE_FILE_COPY
{
// The XLOG record was renamed between v14 and v15, // The XLOG record was renamed between v14 and v15,
// but the record format is the same. // but the record format is the same.
// So we can reuse XlCreateDatabase here. // So we can reuse XlCreateDatabase here.
debug!("XLOG_DBASE_CREATE_FILE_COPY"); debug!("XLOG_DBASE_CREATE_WAL_LOG");
let createdb = XlCreateDatabase::decode(&mut buf); let createdb = XlCreateDatabase::decode(&mut buf);
self.ingest_xlog_dbase_create(modification, &createdb, ctx) self.ingest_xlog_dbase_create(modification, &createdb, ctx)
.await?; .await?;
} else if (decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK) }
== postgres_ffi::v15::bindings::XLOG_DBASE_DROP postgres_ffi::v15::bindings::XLOG_DBASE_DROP => {
{
let dropdb = XlDropDatabase::decode(&mut buf); let dropdb = XlDropDatabase::decode(&mut buf);
for tablespace_id in dropdb.tablespace_ids { for tablespace_id in dropdb.tablespace_ids {
trace!("Drop db {}, {}", tablespace_id, dropdb.db_id); trace!("Drop db {}, {}", tablespace_id, dropdb.db_id);
@@ -176,24 +171,21 @@ impl<'a> WalIngest<'a> {
.await?; .await?;
} }
} }
_ => {}
}
} else if self.timeline.pg_version == 16 { } else if self.timeline.pg_version == 16 {
if (decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK) match decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK {
== postgres_ffi::v16::bindings::XLOG_DBASE_CREATE_WAL_LOG postgres_ffi::v16::bindings::XLOG_DBASE_CREATE_WAL_LOG
{ | postgres_ffi::v16::bindings::XLOG_DBASE_CREATE_FILE_COPY => {
debug!("XLOG_DBASE_CREATE_WAL_LOG: noop");
} else if (decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK)
== postgres_ffi::v16::bindings::XLOG_DBASE_CREATE_FILE_COPY
{
// The XLOG record was renamed between v14 and v15, // The XLOG record was renamed between v14 and v15,
// but the record format is the same. // but the record format is the same.
// So we can reuse XlCreateDatabase here. // So we can reuse XlCreateDatabase here.
debug!("XLOG_DBASE_CREATE_FILE_COPY"); debug!("XLOG_DBASE_CREATE_WAL_LOG");
let createdb = XlCreateDatabase::decode(&mut buf); let createdb = XlCreateDatabase::decode(&mut buf);
self.ingest_xlog_dbase_create(modification, &createdb, ctx) self.ingest_xlog_dbase_create(modification, &createdb, ctx)
.await?; .await?;
} else if (decoded.xl_info & pg_constants::XLR_RMGR_INFO_MASK) }
== postgres_ffi::v16::bindings::XLOG_DBASE_DROP postgres_ffi::v16::bindings::XLOG_DBASE_DROP => {
{
let dropdb = XlDropDatabase::decode(&mut buf); let dropdb = XlDropDatabase::decode(&mut buf);
for tablespace_id in dropdb.tablespace_ids { for tablespace_id in dropdb.tablespace_ids {
trace!("Drop db {}, {}", tablespace_id, dropdb.db_id); trace!("Drop db {}, {}", tablespace_id, dropdb.db_id);
@@ -202,6 +194,8 @@ impl<'a> WalIngest<'a> {
.await?; .await?;
} }
} }
_ => {}
}
} }
} else if decoded.xl_rmid == pg_constants::RM_TBLSPC_ID { } else if decoded.xl_rmid == pg_constants::RM_TBLSPC_ID {
trace!("XLOG_TBLSPC_CREATE/DROP is not handled yet"); trace!("XLOG_TBLSPC_CREATE/DROP is not handled yet");