Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagec
struct meta_blob_header {
  uint32_t  mbh_magic;
  uint32_t  mbh_version;
  uuid_t    mbh_meta_devid;   /* Meta SSD device ID */
  uuid_t    mbh_wal_devid;    /* WAL device ID */
  uuid_t    mbh_data_devid;   /* Data device ID */
  uint64_t  mbh_meta_blobid;  /* Meta SPDK blob ID */
  uint64_t  mbh_wal_blobid;   /* WAL SPDK blob ID */
  uint64_t  mbh_data_blobid;  /* Data SPDK blob ID */
  uint32_t  mbh_blk_bytes;    /* Block size for meta blob, in bytes */
  uint32_t  mbh_hdr_blks;     /* Meta blob header size, in blocks */
  uint64_t  mbh_tot_blks;     /* Meta blob capacity, in blocks */
  uint32_t  mbh_vos_id;       /* Meta target ID, per engine ID */
  uint16uint32_t  mbh_csum_typepadding[6];    /* Checksum typeReserved */
  uint16uint32_t  mbh_csum_len;     /* Checksum length in bytes */   uint8_t   mbh_csum[0];      /* Checksum of thethis header */
};
  • The layout of metadata area (TBD)

...

Code Block
languagec
struct wal_header {
  uint32_t  wh_magic;
  uint16uint32_t  wh_csum_type; /* Checksum type used for checking transaction data integrityversion;
  uint32_t  wh_gen;       /* WAL re-format timestamp */
  uint16_t  wh_blk_bytes; /* WAL block size, usually 4k */
  uint16_t  wh_padding1;  /* Reserved */
  uint64_t  wh_tot_blks;  /* WAL blob capacity, in blocks */
  uint64_t  wh_ckp_id;    /* Last checkpointed transaction ID */
  uint64_t  wh_commit_id; /* Last committed transaction ID */
  uint64uint32_t  wh_nextckp_idblks;   /* Next unused transaction ID Blocks used by last check-pointed transaction */
  uint32_t  wh_csum_len_commit_blks; /* Blocks used by last committed transaction */
  uint64_t  wh_padding2;  /* Checksum length in bytes Reserved */
  uint32_t  wh_padding3;  /* Reserved */
  uint8uint32_t   wchwh_csum[0];      /* Checksum of thethis header */
};

The WAL transaction ID consists of two parts:

...

Each transaction starts with a “WAL transaction header” entry, and it’s followed by one or multiple “WAL transaction operation” entries, the payload data from entries are concatenated after the last entry of a transaction is “WAL transaction csum” entry, it contains the checksum of all these entries and will be used for data integrity check on recovery phasepayload data is placed after the payload (or the last entry when there is no payload).

Each transaction is always stored from the beginning of a block, and if any transaction spans multiple blocks, the WAL transaction header will be put to the beginning of every involved block. If a transaction entry is too large to fit into a block, it needs be split into multiple entries.

  • The durable format of WAL transaction entries are defined as following:

Code Block
languagec
#define WAL_HDR_FL_CSUM 0x1 /* The tail csum entry is in current block */

struct wal_trans_head {
  uint32_t  wth_magic;
  uint16uint32_t  wth_lengen;    /* TransactionWAL data length within current block, in bytes */
  uint16_t  wth_flags;  /* Transaction header flags *re-format timestamp */
  uint64_t  wth_id;     /* Transaction ID */
};  enum wal_trans_op_type {
  /* Memory copy data to given meta blob offset */
  WAL_OP_MEMCPY = 0,uint32_t  wth_tot_ents;     /* Memory move data of given meta blob offset Total entries */
  WAL_OP_MEMMOVE,
  /* Zeroing data from given meta blob offset */
  WAL_OP_ZEROING,
uint32_t  wth_tot_payload;  /* ChecksumTotal ofpayload givensize datain onbytes data blob */
  WAL_OP_CSUM,
  WAL_OP_MAX,
};

struct wal_trans_entry {
  uint64_t  wte_off;    /* Offset within meta or data blob, in bytes */
  uint32uint16_t  wte_type;   /* Operation type, see umem design */
  uint32uint16_t  wte_len;    /* Data length in bytes */
  uint8uint32_t   wte_data[0];
;   /* Varioius inline data */
};

struct wal_trans_csumtail {
  uint32_t  wtc_lencsum;    /* Checksum lengthof inthe bytestransaction */
  uint8_t   wtc_csum[0];
};