Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update solana to 1.18.15 and postgresql to 16 #66

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ Cargo.lock
**/*.rs.bk

farf/
.idea
.DS_Store

62 changes: 31 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Solana Maintainers <[email protected]>"]
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/"
Expand All @@ -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"]
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)
Expand All @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion ci/install-build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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';"
Expand Down
10 changes: 5 additions & 5 deletions ci/rust-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions scripts/drop_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
14 changes: 7 additions & 7 deletions scripts/postgresql.conf
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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

Expand All @@ -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 -
Expand Down
2 changes: 1 addition & 1 deletion src/geyser_plugin_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {:?}",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_postgres_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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';"
Expand Down