PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include "catalog/pg_type_d.h"
#include "common/connect.h"
#include "datapagemap.h"
#include "file_ops.h"
#include "filemap.h"
#include "lib/stringinfo.h"
#include "pg_rewind.h"
#include "port/pg_bswap.h"
#include "rewind_source.h"
Go to the source code of this file.
Data Structures | |
struct | fetch_range_request |
struct | libpq_source |
Macros | |
#define | MAX_CHUNK_SIZE (1024 * 1024) |
#define | MAX_CHUNKS_PER_QUERY 1000 |
Functions | |
static void | init_libpq_conn (PGconn *conn) |
static char * | run_simple_query (PGconn *conn, const char *sql) |
static void | run_simple_command (PGconn *conn, const char *sql) |
static void | appendArrayEscapedString (StringInfo buf, const char *str) |
static void | process_queued_fetch_requests (libpq_source *src) |
static void | libpq_traverse_files (rewind_source *source, process_file_callback_t callback) |
static void | libpq_queue_fetch_file (rewind_source *source, const char *path, size_t len) |
static void | libpq_queue_fetch_range (rewind_source *source, const char *path, off_t off, size_t len) |
static void | libpq_finish_fetch (rewind_source *source) |
static char * | libpq_fetch_file (rewind_source *source, const char *path, size_t *filesize) |
static XLogRecPtr | libpq_get_current_wal_insert_lsn (rewind_source *source) |
static void | libpq_destroy (rewind_source *source) |
rewind_source * | init_libpq_source (PGconn *conn) |
#define MAX_CHUNK_SIZE (1024 * 1024) |
Definition at line 26 of file libpq_source.c.
#define MAX_CHUNKS_PER_QUERY 1000 |
Definition at line 27 of file libpq_source.c.
|
static |
Definition at line 614 of file libpq_source.c.
References appendStringInfoCharMacro, buf, and str.
Referenced by process_queued_fetch_requests().
|
static |
Definition at line 111 of file libpq_source.c.
References ALWAYS_SECURE_SEARCH_PATH_SQL, conn, pg_fatal, pg_free(), PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQexec(), PQprepare(), PQresultErrorMessage(), PQresultStatus(), res, run_simple_command(), run_simple_query(), and str.
Referenced by init_libpq_source().
rewind_source* init_libpq_source | ( | PGconn * | conn | ) |
Definition at line 82 of file libpq_source.c.
References libpq_source::common, conn, libpq_source::conn, rewind_source::destroy, rewind_source::fetch_file, rewind_source::finish_fetch, rewind_source::get_current_wal_insert_lsn, init_libpq_conn(), initStringInfo(), libpq_source::lengths, libpq_destroy(), libpq_fetch_file(), libpq_finish_fetch(), libpq_get_current_wal_insert_lsn(), libpq_queue_fetch_file(), libpq_queue_fetch_range(), libpq_traverse_files(), libpq_source::offsets, libpq_source::paths, pg_malloc0(), rewind_source::queue_fetch_file, rewind_source::queue_fetch_range, and rewind_source::traverse_files.
Referenced by main().
|
static |
Definition at line 675 of file libpq_source.c.
References StringInfoData::data, libpq_source::lengths, libpq_source::offsets, libpq_source::paths, pfree(), and source.
Referenced by init_libpq_source().
|
static |
Definition at line 635 of file libpq_source.c.
References conn, len, pg_fatal, pg_log_debug, pg_malloc(), PGRES_TUPLES_OK, PQclear(), PQexecParams(), PQgetisnull(), PQgetlength(), PQgetvalue(), PQntuples(), PQresultErrorMessage(), PQresultStatus(), res, and source.
Referenced by init_libpq_source().
|
static |
Definition at line 421 of file libpq_source.c.
References process_queued_fetch_requests(), and source.
Referenced by init_libpq_source().
|
static |
Definition at line 209 of file libpq_source.c.
References conn, pg_fatal, pg_free(), run_simple_query(), source, and val.
Referenced by init_libpq_source().
|
static |
Definition at line 326 of file libpq_source.c.
References len, libpq_queue_fetch_range(), Max, MAX_CHUNK_SIZE, open_target_file(), and source.
Referenced by init_libpq_source().
|
static |
Definition at line 356 of file libpq_source.c.
References len, fetch_range_request::length, MAX_CHUNK_SIZE, MAX_CHUNKS_PER_QUERY, Min, libpq_source::num_requests, fetch_range_request::offset, fetch_range_request::path, process_queued_fetch_requests(), libpq_source::request_queue, and source.
Referenced by init_libpq_source(), and libpq_queue_fetch_file().
|
static |
Definition at line 233 of file libpq_source.c.
References callback(), conn, FILE_TYPE_DIRECTORY, FILE_TYPE_REGULAR, FILE_TYPE_SYMLINK, i, is_absolute_path, pg_fatal, PGRES_TUPLES_OK, PQclear(), PQexec(), PQgetisnull(), PQgetvalue(), PQnfields(), PQntuples(), PQresultErrorMessage(), PQresultStatus(), res, source, and type.
Referenced by init_libpq_source().
|
static |
Definition at line 427 of file libpq_source.c.
References appendArrayEscapedString(), appendStringInfo(), appendStringInfoChar(), chunk, libpq_source::conn, StringInfoData::data, filename, i, INT64_FORMAT, fetch_range_request::length, libpq_source::lengths, libpq_source::num_requests, fetch_range_request::offset, libpq_source::offsets, open_target_file(), fetch_range_request::path, libpq_source::paths, pg_fatal, pg_free(), pg_log_debug, pg_malloc(), pg_ntoh64, PGRES_SINGLE_TUPLE, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQfformat(), PQftype(), PQgetisnull(), PQgetlength(), PQgetResult(), PQgetvalue(), PQnfields(), PQntuples(), PQresultErrorMessage(), PQresultStatus(), PQsendQueryPrepared(), PQsetSingleRowMode(), remove_target_file(), libpq_source::request_queue, res, resetStringInfo(), and write_target_range().
Referenced by libpq_finish_fetch(), and libpq_queue_fetch_range().
|
static |
Definition at line 192 of file libpq_source.c.
References conn, pg_fatal, PGRES_COMMAND_OK, PQclear(), PQexec(), PQresultErrorMessage(), PQresultStatus(), and res.
Referenced by init_libpq_conn().
|
static |
Definition at line 164 of file libpq_source.c.
References conn, pg_fatal, pg_strdup(), PGRES_TUPLES_OK, PQclear(), PQexec(), PQgetisnull(), PQgetvalue(), PQnfields(), PQntuples(), PQresultErrorMessage(), PQresultStatus(), and res.
Referenced by init_libpq_conn(), and libpq_get_current_wal_insert_lsn().