![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Migrate old flat provsql mmap files to the per-database layout. More...
#include <libpq-fe.h>#include <cassert>#include <cerrno>#include <cstdint>#include <cstdio>#include <cstdlib>#include <cstring>#include <functional>#include <iostream>#include <queue>#include <stdexcept>#include <string>#include <unordered_map>#include <unordered_set>#include <utility>#include <vector>#include <fcntl.h>#include <sys/mman.h>#include <sys/stat.h>#include <unistd.h>
Go to the source code of this file.
Classes | |
| struct | pg_uuid_t |
| UUID structure. More... | |
| struct | UUIDHash |
| struct | UUIDEq |
| struct | GateInformation |
Per-gate metadata stored in the gates MMappedVector. More... | |
| struct | OldVecHdr |
| struct | OldHashSlot |
| struct | OldTableHdr |
| class | OldMMapVec |
| class | OldMMapHash |
| struct | OldCircuit |
| struct | NewVecHdr |
| struct | NewHashSlot |
| struct | NewTableHdr |
| struct | Conn |
| struct | Res |
| struct | GateData |
Typedefs | |
| using | UUIDSet = std::unordered_set<pg_uuid_t, UUIDHash, UUIDEq> |
Enumerations | |
| enum | gate_type { gate_input , gate_plus , gate_times , gate_monus , gate_project , gate_zero , gate_one , gate_eq , gate_agg , gate_semimod , gate_cmp , gate_delta , gate_value , gate_mulinput , gate_update , gate_invalid , nb_gate_types } |
Functions | |
| static void | writeNewVector (const std::string &path, uint64_t magic, size_t elem_size, const uint8_t *raw, unsigned long nb) |
| static void | writeNewHashTable (const std::string &path, const std::vector< std::pair< pg_uuid_t, unsigned long > > &entries) |
| static pg_uuid_t | parseUUID (const char *s) |
| static std::unordered_map< unsigned long, GateData > | collectReachable (const OldCircuit &old, const UUIDSet &roots) |
| static void | migrateDatabase (const OldCircuit &old, const std::string &pgdata, Oid db_oid, const UUIDSet &roots) |
| int | main (int argc, char **argv) |
Variables | |
| static constexpr unsigned long | NOTHING = static_cast<unsigned long>(-1) |
| static constexpr uint64_t | MAGIC_GATES |
| static constexpr uint64_t | MAGIC_WIRES |
| static constexpr uint64_t | MAGIC_MAPPING |
| static constexpr uint64_t | MAGIC_EXTRA |
Migrate old flat provsql mmap files to the per-database layout.
Old format: $PGDATA/provsql_*.mmap (no 16-byte header) New format: $PGDATA/base/<db_oid>/provsql_*.mmap (16-byte header)
For each database that has provsql installed, the tool:
Usage: provsql_migrate_mmap -D <pgdata> -c <connstr>
connstr should point to the postgres / template1 database so the tool can enumerate all databases. The tool then re-connects per database. If connstr already contains "dbname=", append " dbname=\<target\>" to override it (libpq uses the last occurrence).
Gates belonging to tables in more than one database are written to every relevant database. UUID v4 collisions across databases are negligible.
The tool skips any database whose $PGDATA/base/<oid>/provsql_gates.mmap already exists.
Definition in file provsql_migrate_mmap.cpp.
Definition at line 68 of file provsql_migrate_mmap.cpp.
| enum gate_type |
| Enumerator | |
|---|---|
| gate_input | |
| gate_plus | |
| gate_times | |
| gate_monus | |
| gate_project | |
| gate_zero | |
| gate_one | |
| gate_eq | |
| gate_agg | |
| gate_semimod | |
| gate_cmp | |
| gate_delta | |
| gate_value | |
| gate_mulinput | |
| gate_update | |
| gate_invalid | |
| nb_gate_types | |
Definition at line 71 of file provsql_migrate_mmap.cpp.
|
static |
Definition at line 413 of file provsql_migrate_mmap.cpp.


| int main | ( | int | argc, |
| char ** | argv ) |
|
static |
Definition at line 446 of file provsql_migrate_mmap.cpp.


|
static |
Definition at line 386 of file provsql_migrate_mmap.cpp.

|
static |
Definition at line 318 of file provsql_migrate_mmap.cpp.

|
static |
Definition at line 288 of file provsql_migrate_mmap.cpp.

|
staticconstexpr |
Definition at line 259 of file provsql_migrate_mmap.cpp.
|
staticconstexpr |
Definition at line 250 of file provsql_migrate_mmap.cpp.
|
staticconstexpr |
Definition at line 256 of file provsql_migrate_mmap.cpp.
|
staticconstexpr |
Definition at line 253 of file provsql_migrate_mmap.cpp.
|
staticconstexpr |
Definition at line 111 of file provsql_migrate_mmap.cpp.