handle XLOG_DBASE_CREATE in waldecoder

This commit is contained in:
anastasia
2021-04-23 14:06:09 +03:00
parent 573f1ada83
commit b64bd2a8af
2 changed files with 44 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ use bytes::{Buf, BufMut, Bytes, BytesMut};
use log::*;
use std::cmp::min;
use thiserror::Error;
use std::str;
const XLOG_BLCKSZ: u32 = 8192;
@@ -678,6 +679,40 @@ pub fn decode_wal_record(record: Bytes) -> DecodedWALRecord {
//TODO parse abort record to extract subtrans entries
}
}
else if xl_rmid == pg_constants::RM_DBASE_ID
{
let info = xl_info & !pg_constants::XLR_INFO_MASK;
if info == pg_constants::XLOG_DBASE_CREATE
{
//buf points to main_data
let db_id = buf.get_u32_le();
let tablespace_id = buf.get_u32_le();
let src_db_id = buf.get_u32_le();
let src_tablespace_id = buf.get_u32_le();
trace!("XLOG_DBASE_CREATE db_id {} src_db_id {}", db_id, src_db_id);
// in postgres it is implemented as copydir
// we need to copy all pages in page_cache
}
else
{
trace!("XLOG_DBASE_DROP is not handled yet");
}
}
else if xl_rmid == pg_constants::RM_TBLSPC_ID
{
let info = xl_info & !pg_constants::XLR_INFO_MASK;
if info == pg_constants::XLOG_TBLSPC_CREATE
{
//buf points to main_data
let ts_id = buf.get_u32_le();
let ts_path = str::from_utf8(&buf).unwrap();
trace!("XLOG_TBLSPC_CREATE ts_id {} ts_path {}", ts_id, ts_path);
}
else
{
trace!("XLOG_TBLSPC_DROP is not handled yet");
}
}
DecodedWALRecord {
xl_info,