diff --git a/.gitignore b/.gitignore index 0e5c61b..b4f5846 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ Cargo.lock **/*.rs.bk farf/ +.idea +.DS_Store + diff --git a/Cargo.toml b/Cargo.toml index b1ea949..844e455 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Solana Maintainers "] edition = "2021" name = "solana-geyser-plugin-postgres" description = "The Solana AccountsDb plugin for PostgreSQL database." -version = "1.17.3" +version = "1.18.15" repository = "https://github.com/solana-labs/solana-accountsdb-plugin-postgres" license = "Apache-2.0" homepage = "https://solana.com/" @@ -13,40 +13,40 @@ documentation = "https://docs.rs/solana-validator" crate-type = ["cdylib", "rlib"] [dependencies] -bs58 = "0.4.0" -bytemuck = "1.12.1" -chrono = { version = "0.4.24", features = ["serde"] } -crossbeam-channel = "0.5.7" -log = "0.4.17" -openssl = { version = "0.10.42" } -postgres = { version = "0.19.4", features = ["with-chrono-0_4"] } -postgres-types = { version = "0.2.4", features = ["derive"] } +bs58 = "0.5.1" +bytemuck = "1.16.1" +chrono = { version = "0.4.38", features = ["serde"] } +crossbeam-channel = "0.5.13" +log = "0.4.22" +openssl = { version = "0.10.64" } +postgres = { version = "0.19.7", features = ["with-chrono-0_4"] } +postgres-types = { version = "0.2.6", features = ["derive"] } postgres-openssl = { version = "0.5.0"} -serde = "1.0.145" -serde_derive = "1.0.145" -serde_json = "1.0.85" -solana-geyser-plugin-interface = { version = "=1.17.3" } -solana-logger = { version = "1.17.3" } -solana-measure = { version = "1.17.3" } -solana-metrics = { version = "1.17.3" } -solana-runtime = { version = "1.17.3" } -solana-sdk = { version = "1.17.3" } -solana-transaction-status = { version = "1.17.3" } -thiserror = "1.0.37" -tokio-postgres = "0.7.7" +serde = "1.0.204" +serde_derive = "1.0.204" +serde_json = "1.0.120" +solana-geyser-plugin-interface = { version = "=1.18.15" } +solana-logger = { version = "1.18.15" } +solana-measure = { version = "1.18.15" } +solana-metrics = { version = "1.18.15" } +solana-runtime = { version = "1.18.15" } +solana-sdk = { version = "1.18.15" } +solana-transaction-status = { version = "1.18.15" } +thiserror = "1.0.61" +tokio-postgres = "0.7.10" [dev-dependencies] -libc = "0.2.134" -libloading = "0.7.3" -serial_test = "0.9.0" -socket2 = { version = "0.4.7", features = ["all"] } +libc = "0.2.155" +libloading = "0.8.4" +serial_test = "3.1.1" +socket2 = { version = "0.5.7", features = ["all"] } -solana-account-decoder = { version = "1.17.3" } -solana-core = { version = "1.17.3" } -solana-local-cluster = { version = "1.17.3" } -solana-net-utils = { version = "1.17.3" } -solana-streamer = { version = "1.17.3" } -tempfile = "3.3.0" +solana-account-decoder = { version = "1.18.15" } +solana-core = { version = "1.18.15" } +solana-local-cluster = { version = "1.18.15" } +solana-net-utils = { version = "1.18.15" } +solana-streamer = { version = "1.18.15" } +tempfile = "3.10.1" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/README.md b/README.md index abc7485..e1be9d0 100644 --- a/README.md +++ b/README.md @@ -118,18 +118,18 @@ To select all vote transactions: Please follow [PostgreSQL Ubuntu Installation](https://www.postgresql.org/download/linux/ubuntu/) on instructions to install the PostgreSQL database server. For example, to -install postgresql-14, +install postgresql-16, ``` sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update -sudo apt-get -y install postgresql-14 +sudo apt-get -y install postgresql-16 ``` #### Control the Database Access Modify the pg_hba.conf as necessary to grant the plugin to access the database. -For example, in /etc/postgresql/14/main/pg_hba.conf, the following entry allows +For example, in /etc/postgresql/16/main/pg_hba.conf, the following entry allows nodes with IPs in the CIDR 10.138.0.0/24 to access all databases. The validator runs in a node with an ip in the specified range. @@ -142,10 +142,10 @@ better performance. #### Configure the Database Performance Parameters -Please refer to the [PostgreSQL Server Configuration](https://www.postgresql.org/docs/14/runtime-config.html) +Please refer to the [PostgreSQL Server Configuration](https://www.postgresql.org/docs/16/runtime-config.html) for configuration details. The referential implementation uses the following -configurations for better database performance in the /etc/postgresql/14/main/postgresql.conf -which are different from the default postgresql-14 installation. +configurations for better database performance in the /etc/postgresql/16/main/postgresql.conf +which are different from the default postgresql-16 installation. ``` max_connections = 200 # (change requires restart) @@ -165,7 +165,7 @@ The sample scripts/postgresql.conf can be used for reference. Start the server: ``` -sudo systemctl start postgresql@14-main +sudo systemctl start postgresql@16-main ``` Create the database. For example, the following creates a database named 'solana': diff --git a/ci/install-build-deps.sh b/ci/install-build-deps.sh index 22f9bcf..638594b 100755 --- a/ci/install-build-deps.sh +++ b/ci/install-build-deps.sh @@ -6,7 +6,7 @@ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs) wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update -sudo apt-get install -y postgresql-14 +sudo apt-get install -y postgresql-16 sudo /etc/init.d/postgresql start sudo -u postgres psql --command "CREATE USER solana WITH SUPERUSER PASSWORD 'solana';" diff --git a/ci/rust-version.sh b/ci/rust-version.sh index b8acf11..6775a7c 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -18,13 +18,13 @@ if [[ -n $RUST_STABLE_VERSION ]]; then stable_version="$RUST_STABLE_VERSION" else - stable_version=1.73.0 + stable_version=1.79.0 fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2023-10-05 + nightly_version=2024-06-26 fi @@ -51,9 +51,9 @@ export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version" stable) rustup_install "$rust_stable" ;; - # nightly) - # rustup_install "$rust_nightly" - # ;; + nightly) + rustup_install "$rust_nightly" + ;; all) rustup_install "$rust_stable" rustup_install "$rust_nightly" diff --git a/scripts/drop_schema.sql b/scripts/drop_schema.sql index 3b3cb10..da53380 100644 --- a/scripts/drop_schema.sql +++ b/scripts/drop_schema.sql @@ -12,6 +12,7 @@ DROP TABLE block; DROP TABLE spl_token_owner_index; DROP TABLE spl_token_mint_index; +DROP TYPE "TransactionStatusMeta" CASCADE; DROP TYPE "TransactionError" CASCADE; DROP TYPE "TransactionErrorCode" CASCADE; DROP TYPE "LoadedMessageV0" CASCADE; @@ -20,9 +21,8 @@ DROP TYPE "TransactionMessageV0" CASCADE; DROP TYPE "TransactionMessage" CASCADE; DROP TYPE "TransactionMessageHeader" CASCADE; DROP TYPE "TransactionMessageAddressTableLookup" CASCADE; -DROP TYPE "TransactionStatusMeta" CASCADE; -DROP TYPE "RewardType" CASCADE; DROP TYPE "Reward" CASCADE; +DROP TYPE "RewardType" CASCADE; DROP TYPE "TransactionTokenBalance" CASCADE; DROP TYPE "InnerInstructions" CASCADE; -DROP TYPE "CompiledInstruction" CASCADE; +DROP TYPE "CompiledInstruction" CASCADE; \ No newline at end of file diff --git a/scripts/postgresql.conf b/scripts/postgresql.conf index 53b089a..3475319 100644 --- a/scripts/postgresql.conf +++ b/scripts/postgresql.conf @@ -1,4 +1,4 @@ -# This a reference configuration file for the PostgreSQL database version 14. +# This a reference configuration file for the PostgreSQL database version 16. # ----------------------------- # PostgreSQL configuration file @@ -41,16 +41,16 @@ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. -data_directory = '/var/lib/postgresql/14/main' # use data in another directory +data_directory = '/var/lib/postgresql/16/main' # use data in another directory # (change requires restart) -hba_file = '/etc/postgresql/14/main/pg_hba.conf' # host-based authentication file +hba_file = '/etc/postgresql/16/main/pg_hba.conf' # host-based authentication file # (change requires restart) -ident_file = '/etc/postgresql/14/main/pg_ident.conf' # ident configuration file +ident_file = '/etc/postgresql/16/main/pg_ident.conf' # ident configuration file # (change requires restart) # If external_pid_file is not explicitly set, no extra PID file is written. -external_pid_file = '/var/run/postgresql/14-main.pid' # write an extra PID file +external_pid_file = '/var/run/postgresql/16-main.pid' # write an extra PID file # (change requires restart) @@ -588,7 +588,7 @@ log_timezone = 'Etc/UTC' # PROCESS TITLE #------------------------------------------------------------------------------ -cluster_name = '14/main' # added to process titles if nonempty +cluster_name = '16/main' # added to process titles if nonempty # (change requires restart) #update_process_title = on @@ -605,7 +605,7 @@ cluster_name = '14/main' # added to process titles if nonempty #track_io_timing = off #track_wal_io_timing = off #track_functions = none # none, pl, all -stats_temp_directory = '/var/run/postgresql/14-main.pg_stat_tmp' +stats_temp_directory = '/var/run/postgresql/16-main.pg_stat_tmp' # - Monitoring - diff --git a/src/geyser_plugin_postgres.rs b/src/geyser_plugin_postgres.rs index a6ec71e..88688ba 100644 --- a/src/geyser_plugin_postgres.rs +++ b/src/geyser_plugin_postgres.rs @@ -168,7 +168,7 @@ impl GeyserPlugin for GeyserPluginPostgres { /// } /// } - fn on_load(&mut self, config_file: &str) -> Result<()> { + fn on_load(&mut self, config_file: &str, _is_reload: bool) -> Result<()> { solana_logger::setup_with_default("info"); info!( "Loading plugin {:?} from config_file {:?}", diff --git a/tests/test_postgres_plugin.rs b/tests/test_postgres_plugin.rs index f9c04a9..40a4417 100644 --- a/tests/test_postgres_plugin.rs +++ b/tests/test_postgres_plugin.rs @@ -8,7 +8,7 @@ use serde_json::json; /// To setup manually on Ubuntu Linux, do the following, /// sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' /// wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -/// apt install -y postgresql-14 +/// apt install -y postgresql-16 /// sudo /etc/init.d/postgresql start /// /// sudo -u postgres psql --command "CREATE USER solana WITH SUPERUSER PASSWORD 'solana';"