PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <dirent.h>
#include <limits.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "common/controldata_utils.h"
#include "common/file_utils.h"
#include "common/logging.h"
#include "common/relpath.h"
#include "fe_utils/option_utils.h"
#include "getopt_long.h"
#include "pg_getopt.h"
#include "storage/bufpage.h"
#include "storage/checksum.h"
#include "storage/checksum_impl.h"
Go to the source code of this file.
Data Structures | |
struct | exclude_list_item |
Enumerations | |
enum | PgChecksumMode { PG_MODE_CHECK , PG_MODE_DISABLE , PG_MODE_ENABLE } |
Functions | |
static void | usage (void) |
static void | progress_report (bool finished) |
static bool | skipfile (const char *fn) |
static void | scan_file (const char *fn, int segmentno) |
static int64 | scan_directory (const char *basedir, const char *subdir, bool sizeonly) |
int | main (int argc, char *argv[]) |
Variables | |
static int64 | files_scanned = 0 |
static int64 | files_written = 0 |
static int64 | blocks_scanned = 0 |
static int64 | blocks_written = 0 |
static int64 | badblocks = 0 |
static ControlFileData * | ControlFile |
static char * | only_filenode = NULL |
static bool | do_sync = true |
static bool | verbose = false |
static bool | showprogress = false |
static DataDirSyncMethod | sync_method = DATA_DIR_SYNC_METHOD_FSYNC |
static PgChecksumMode | mode = PG_MODE_CHECK |
static const char * | progname |
static int64 | total_size = 0 |
static int64 | current_size = 0 |
static pg_time_t | last_progress_report = 0 |
static const struct exclude_list_item | skip [] |
enum PgChecksumMode |
Enumerator | |
---|---|
PG_MODE_CHECK | |
PG_MODE_DISABLE | |
PG_MODE_ENABLE |
Definition at line 48 of file pg_checksums.c.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 432 of file pg_checksums.c.
References _, badblocks, ControlFileData::blcksz, blocks_scanned, blocks_written, ControlFile, ControlFileData::data_checksum_version, DataDir, DB_SHUTDOWNED, DB_SHUTDOWNED_IN_RECOVERY, do_sync, exit(), files_scanned, files_written, get_controlfile(), get_progname(), getopt_long(), mode, no_argument, only_filenode, optarg, optind, option_parse_int(), parse_sync_method(), PG_CONTROL_VERSION, ControlFileData::pg_control_version, PG_DATA_CHECKSUM_VERSION, pg_fatal, pg_log_error, pg_log_error_detail, pg_log_error_hint, pg_log_info, pg_logging_init(), PG_MODE_CHECK, PG_MODE_DISABLE, PG_MODE_ENABLE, PG_TBLSPC_DIR, PG_TEXTDOMAIN, printf, progname, progress_report(), pstrdup(), required_argument, scan_directory(), set_pglocale_pgservice(), showprogress, ControlFileData::state, sync_method, total_size, update_controlfile(), usage(), and verbose.
|
static |
Definition at line 123 of file pg_checksums.c.
References _, Assert, current_size, fprintf, last_progress_report, now(), showprogress, and total_size.
Referenced by main(), and scan_file().
|
static |
Definition at line 299 of file pg_checksums.c.
References basedir, closedir(), dirent::d_name, fn(), lstat, MAXPGPATH, only_filenode, opendir(), pg_fatal, PG_TBLSPC_DIR, PG_TEMP_FILE_PREFIX, PG_TEMP_FILES_DIR, readdir(), S_ISDIR, S_ISLNK, S_ISREG, scan_file(), skipfile(), snprintf, stat::st_mode, stat::st_size, strlcpy(), and TABLESPACE_VERSION_DIRECTORY.
Referenced by main().
|
static |
Definition at line 175 of file pg_checksums.c.
References Assert, badblocks, blocks_scanned, blocks_written, buf, close, ControlFile, current_size, ControlFileData::data_checksum_version, files_scanned, files_written, fn(), mode, PageIsNew(), PageHeaderData::pd_checksum, PG_BINARY, pg_checksum_page(), PG_DATA_CHECKSUM_VERSION, pg_fatal, pg_log_error, pg_log_info, PG_MODE_CHECK, PG_MODE_ENABLE, progress_report(), read, showprogress, verbose, and write.
Referenced by scan_directory().
|
static |
Definition at line 157 of file pg_checksums.c.
References fn(), exclude_list_item::match_prefix, exclude_list_item::name, name, and skip.
Referenced by scan_directory().
|
static |
|
static |
Definition at line 39 of file pg_checksums.c.
Referenced by main(), and scan_file().
|
static |
Definition at line 37 of file pg_checksums.c.
Referenced by main(), and scan_file().
|
static |
Definition at line 38 of file pg_checksums.c.
Referenced by main(), pgstat_slru_flush_cb(), and scan_file().
|
static |
Definition at line 40 of file pg_checksums.c.
Referenced by main(), and scan_file().
|
static |
Definition at line 63 of file pg_checksums.c.
Referenced by ExtendBufferedRelTo(), progress_report(), scan_file(), and unicode_normalize().
Definition at line 43 of file pg_checksums.c.
Referenced by main().
|
static |
Definition at line 35 of file pg_checksums.c.
Referenced by main(), and scan_file().
|
static |
Definition at line 36 of file pg_checksums.c.
Referenced by main(), and scan_file().
|
static |
Definition at line 64 of file pg_checksums.c.
Referenced by progress_report().
|
static |
Definition at line 55 of file pg_checksums.c.
Referenced by _allocAH(), AllocateFile(), be_lo_open(), brinGetTupleForHeapBlock(), BufFileOpenFileSet(), column_privilege_check(), compute_new_xmax_infomask(), create_file_for_extract(), CreateArchive(), dump_variables(), ECPGsetcommit(), ExtendBufferedRelTo(), extract_directory(), FileSetOpen(), from_char_set_mode(), get_mxact_status_for_lock(), GetLockmodeName(), GetMultiXactIdHintBits(), has_any_column_privilege_id(), has_any_column_privilege_id_id(), has_any_column_privilege_id_name(), has_any_column_privilege_name(), has_any_column_privilege_name_id(), has_any_column_privilege_name_name(), has_column_privilege_id_attnum(), has_column_privilege_id_id_attnum(), has_column_privilege_id_id_name(), has_column_privilege_id_name(), has_column_privilege_id_name_attnum(), has_column_privilege_id_name_name(), has_column_privilege_name_attnum(), has_column_privilege_name_id_attnum(), has_column_privilege_name_id_name(), has_column_privilege_name_name(), has_column_privilege_name_name_attnum(), has_column_privilege_name_name_name(), has_database_privilege_id(), has_database_privilege_id_id(), has_database_privilege_id_name(), has_database_privilege_name(), has_database_privilege_name_id(), has_database_privilege_name_name(), has_foreign_data_wrapper_privilege_id(), has_foreign_data_wrapper_privilege_id_id(), has_foreign_data_wrapper_privilege_id_name(), has_foreign_data_wrapper_privilege_name(), has_foreign_data_wrapper_privilege_name_id(), has_foreign_data_wrapper_privilege_name_name(), has_function_privilege_id(), has_function_privilege_id_id(), has_function_privilege_id_name(), has_function_privilege_name(), has_function_privilege_name_id(), has_function_privilege_name_name(), has_language_privilege_id(), has_language_privilege_id_id(), has_language_privilege_id_name(), has_language_privilege_name(), has_language_privilege_name_id(), has_language_privilege_name_name(), has_largeobject_privilege_id(), has_largeobject_privilege_id_id(), has_largeobject_privilege_name_id(), has_schema_privilege_id(), has_schema_privilege_id_id(), has_schema_privilege_id_name(), has_schema_privilege_name(), has_schema_privilege_name_id(), has_schema_privilege_name_name(), has_sequence_privilege_id(), has_sequence_privilege_id_id(), has_sequence_privilege_id_name(), has_sequence_privilege_name(), has_sequence_privilege_name_id(), has_sequence_privilege_name_name(), has_server_privilege_id(), has_server_privilege_id_id(), has_server_privilege_id_name(), has_server_privilege_name(), has_server_privilege_name_id(), has_server_privilege_name_name(), has_table_privilege_id(), has_table_privilege_id_id(), has_table_privilege_id_name(), has_table_privilege_name(), has_table_privilege_name_id(), has_table_privilege_name_name(), has_tablespace_privilege_id(), has_tablespace_privilege_id_id(), has_tablespace_privilege_id_name(), has_tablespace_privilege_name(), has_tablespace_privilege_name_id(), has_tablespace_privilege_name_name(), has_type_privilege_id(), has_type_privilege_id_id(), has_type_privilege_id_name(), has_type_privilege_name(), has_type_privilege_name_id(), has_type_privilege_name_name(), heap_acquire_tuplock(), heap_lock_tuple(), heap_lock_updated_tuple(), heap_lock_updated_tuple_rec(), heapam_tuple_lock(), InitDiscoverCompressFileHandle(), lo_creat(), lo_open(), LockBuffer(), logfile_open(), LWLockAcquire(), LWLockAcquireOrWait(), LWLockAttemptLock(), LWLockConditionalAcquire(), LWLockHeldByMeInMode(), LWLockQueueSelf(), LWLockRelease(), main(), object_aclcheck(), object_aclcheck_ext(), open_direct(), open_none(), open_target_file(), open_write_none(), OpenPipeStream(), parseArchiveFormat(), PathNameOpenTemporaryFile(), pg_attribute_aclcheck(), pg_attribute_aclcheck_all(), pg_attribute_aclcheck_all_ext(), pg_attribute_aclcheck_ext(), pg_class_aclcheck(), pg_class_aclcheck_ext(), pg_has_role_id(), pg_has_role_id_id(), pg_has_role_id_name(), pg_has_role_name(), pg_has_role_name_id(), pg_has_role_name_name(), pg_largeobject_aclcheck_snapshot(), pg_lock_status(), pg_parameter_aclcheck(), pg_role_aclcheck(), pgp_s2k_fill(), pgp_set_s2k_mode(), pgp_set_text_mode(), pgp_set_unicode_mode(), popen_check(), process_pm_shutdown_request(), raw_parser(), ReadBuffer_common(), ReadBufferBI(), ReadBufferExtended(), ReadBufferWithoutRelcache(), scan_file(), SetOutput(), SyncRepQueueInsert(), SyncRepWaitForLSN(), SyncRepWakeQueue(), table_tuple_lock(), TargetPrivilegesCheck(), tarOpen(), test_lockmode_for_conflict(), WaitForWorkers(), whenever_action(), XLogReadBufferExtended(), XLogReadBufferForRedoExtended(), and ZeroAndLockBuffer().
|
static |
Definition at line 42 of file pg_checksums.c.
Referenced by main(), and scan_directory().
|
static |
Definition at line 57 of file pg_checksums.c.
Referenced by main().
Definition at line 45 of file pg_checksums.c.
Referenced by main(), progress_report(), and scan_file().
|
static |
Definition at line 67 of file pg_checksums.c.
Referenced by array_replace_internal(), DefineVirtualRelation(), dependencies_clauselist_selectivity(), filter_partitions(), heap_hot_search_buffer(), initTrie(), json_build_object_worker(), json_object_agg_transfn_worker(), jsonb_build_object_worker(), jsonb_object_agg_transfn_worker(), skipfile(), and verify_heapam().
|
static |
Definition at line 46 of file pg_checksums.c.
Referenced by main().
|
static |
Definition at line 62 of file pg_checksums.c.
Referenced by main(), make_new_segment(), and progress_report().
Definition at line 44 of file pg_checksums.c.
Referenced by main(), and scan_file().