cargo fmt

This commit is contained in:
anastasia
2021-04-28 13:58:27 +03:00
committed by lubennikovaav
parent e7b112aacc
commit b49164a1d4
6 changed files with 13 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
use postgres_ffi::pg_constants;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use log::*;
use postgres_ffi::pg_constants;
use postgres_ffi::xlog_utils::XLogRecord;
use std::cmp::min;
use std::str;
@@ -312,11 +312,10 @@ pub struct DecodedWALRecord {
// // FIXME: refactor this and decode_wal_record() below to avoid the duplication.
// fn is_xlog_switch_record(rec: &Bytes) -> bool {
// let mut buf = rec.clone();
// let xlogrec = XLogRecord::from_bytes(&mut buf);
// xlogrec.xl_info == pg_constants::XLOG_SWITCH && xlogrec.xl_rmid == pg_constants::RM_XLOG_ID
// }
pub type Oid = u32;
pub type BlockNumber = u32;
@@ -510,7 +509,9 @@ pub fn decode_wal_record(record: Bytes) -> DecodedWALRecord {
* bimg_len < BLCKSZ if the HAS_HOLE flag is set.
*/
if blk.bimg_info & pg_constants::BKPIMAGE_HAS_HOLE != 0
&& (blk.hole_offset == 0 || blk.hole_length == 0 || blk.bimg_len == pg_constants::BLCKSZ)
&& (blk.hole_offset == 0
|| blk.hole_length == 0
|| blk.bimg_len == pg_constants::BLCKSZ)
{
// TODO
/*
@@ -546,7 +547,9 @@ pub fn decode_wal_record(record: Bytes) -> DecodedWALRecord {
* cross-check that bimg_len < BLCKSZ if the IS_COMPRESSED
* flag is set.
*/
if (blk.bimg_info & pg_constants::BKPIMAGE_IS_COMPRESSED == 0) && blk.bimg_len == pg_constants::BLCKSZ {
if (blk.bimg_info & pg_constants::BKPIMAGE_IS_COMPRESSED == 0)
&& blk.bimg_len == pg_constants::BLCKSZ
{
// TODO
/*
report_invalid_record(state,

View File

@@ -14,8 +14,8 @@ use crate::ZTimelineId;
use anyhow::Error;
use lazy_static::lazy_static;
use log::*;
use postgres_ffi::xlog_utils::*;
use postgres_ffi::pg_constants;
use postgres_ffi::xlog_utils::*;
use postgres_protocol::message::backend::ReplicationMessage;
use postgres_types::PgLsn;
use std::collections::HashMap;

View File

@@ -36,10 +36,10 @@ use zenith_utils::lsn::Lsn;
use crate::page_cache::BufferTag;
use crate::page_cache::WALRecord;
use crate::ZTimelineId;
use crate::PageServerConf;
use postgres_ffi::xlog_utils::{XLogRecord};
use crate::ZTimelineId;
use postgres_ffi::pg_constants;
use postgres_ffi::xlog_utils::XLogRecord;
static TIMEOUT: Duration = Duration::from_secs(20);

View File

@@ -3,8 +3,8 @@
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
pub mod xlog_utils;
pub mod pg_constants;
pub mod xlog_utils;
use bytes::{Buf, Bytes, BytesMut};

View File

@@ -71,7 +71,6 @@ pub const XLOG_TBLSPC_DROP: u8 = 0x10;
pub const SIZEOF_XLOGRECORD: u32 = 24;
// FIXME:
pub const BLCKSZ: u16 = 8192;

View File

@@ -299,7 +299,6 @@ impl XLogRecord {
// Is this record an XLOG_SWITCH record? They need some special processing,
pub fn is_xlog_switch_record(&self) -> bool {
self.xl_info == pg_constants::XLOG_SWITCH && self.xl_rmid == pg_constants::RM_XLOG_ID
self.xl_info == pg_constants::XLOG_SWITCH && self.xl_rmid == pg_constants::RM_XLOG_ID
}
}