2
0

dbcommands_xlog.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*-------------------------------------------------------------------------
  2. *
  3. * dbcommands_xlog.h
  4. * Database resource manager XLOG definitions (create/drop database).
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/commands/dbcommands_xlog.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef DBCOMMANDS_XLOG_H
  15. #define DBCOMMANDS_XLOG_H
  16. #include "access/xlogreader.h"
  17. #include "lib/stringinfo.h"
  18. /* record types */
  19. #define XLOG_DBASE_CREATE_FILE_COPY 0x00
  20. #define XLOG_DBASE_CREATE_WAL_LOG 0x10
  21. #define XLOG_DBASE_DROP 0x20
  22. /*
  23. * Single WAL record for an entire CREATE DATABASE operation. This is used
  24. * by the FILE_COPY strategy.
  25. */
  26. typedef struct xl_dbase_create_file_copy_rec
  27. {
  28. Oid db_id;
  29. Oid tablespace_id;
  30. Oid src_db_id;
  31. Oid src_tablespace_id;
  32. } xl_dbase_create_file_copy_rec;
  33. /*
  34. * WAL record for the beginning of a CREATE DATABASE operation, when the
  35. * WAL_LOG strategy is used. Each individual block will be logged separately
  36. * afterward.
  37. */
  38. typedef struct xl_dbase_create_wal_log_rec
  39. {
  40. Oid db_id;
  41. Oid tablespace_id;
  42. } xl_dbase_create_wal_log_rec;
  43. typedef struct xl_dbase_drop_rec
  44. {
  45. Oid db_id;
  46. int ntablespaces; /* number of tablespace IDs */
  47. Oid tablespace_ids[FLEXIBLE_ARRAY_MEMBER];
  48. } xl_dbase_drop_rec;
  49. #define MinSizeOfDbaseDropRec offsetof(xl_dbase_drop_rec, tablespace_ids)
  50. extern void dbase_redo(XLogReaderState *rptr);
  51. extern void dbase_desc(StringInfo buf, XLogReaderState *rptr);
  52. extern const char *dbase_identify(uint8 info);
  53. #endif /* DBCOMMANDS_XLOG_H */