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

Add --console flag for captive core 19.3.0 #4487

Merged
merged 4 commits into from
Jul 28, 2022
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/horizon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
env:
HORIZON_INTEGRATION_TESTS_ENABLED: true
HORIZON_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
PROTOCOL_19_CORE_DEBIAN_PKG_VERSION: 19.2.0-966.d18d54aa3.focal
PROTOCOL_19_CORE_DOCKER_IMG: stellar/stellar-core:19.2.0-966.d18d54aa3.focal
PROTOCOL_18_CORE_DEBIAN_PKG_VERSION: 19.2.0-966.d18d54aa3.focal
PROTOCOL_18_CORE_DOCKER_IMG: stellar/stellar-core:19.2.0-966.d18d54aa3.focal
PROTOCOL_19_CORE_DEBIAN_PKG_VERSION: 19.3.0-1006.9ce6dc4e9.focal
PROTOCOL_19_CORE_DOCKER_IMG: stellar/stellar-core:19.3.0-1006.9ce6dc4e9.focal
PROTOCOL_18_CORE_DEBIAN_PKG_VERSION: 19.3.0-1006.9ce6dc4e9.focal
PROTOCOL_18_CORE_DOCKER_IMG: stellar/stellar-core:19.3.0-1006.9ce6dc4e9.focal
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
name: Test (and push) verify-range image
runs-on: ubuntu-latest
env:
STELLAR_CORE_VERSION: 19.2.0-966.d18d54aa3.focal
STELLAR_CORE_VERSION: 19.3.0-1006.9ce6dc4e9.focal
CAPTIVE_CORE_STORAGE_PATH: /tmp
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion ingest/ledgerbackend/stellar_core_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (r *stellarCoreRunner) getLogLineWriter() io.Writer {
}

func (r *stellarCoreRunner) createCmd(params ...string) *exec.Cmd {
allParams := append([]string{"--conf", r.getConfFileName()}, params...)
allParams := append([]string{"--conf", r.getConfFileName(), "--console"}, params...)
cmd := exec.Command(r.executablePath, allParams...)
cmd.Dir = r.storagePath
cmd.Stdout = r.getLogLineWriter()
Expand Down
7 changes: 7 additions & 0 deletions services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).

**Upgrading to this version from <= v2.8.3 will trigger a state rebuild. During this process (which will take at least 10 minutes), Horizon will not ingest new ledgers.**

### Breaking Changes

* Update core version to 19.3.0 ([4485](https://github.com/stellar/go/pull/4485)).
* Pass `--console` to captive core. This is due to a breaking change in stellar-core 19.3.0 ([4487](https://github.com/stellar/go/pull/4487)).

### Changes

* Run postgres autovacuum on `history_trades_60000` table more frequently. ([4412](https://github.com/stellar/go/pull/4412)).
* Change `protocols/horizon.Transaction.AccountSequence` to `int64` from `string`. ([4409](https://github.com/stellar/go/pull/4409)).
* Add missing signer key type names. ([4429](https://github.com/stellar/go/pull/4429)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
# Note: Please keep the image pinned to an immutable tag matching the Captive Core version.
# This avoid implicit updates which break compatibility between
# the Core container and captive core.
image: ${CORE_IMAGE:-stellar/stellar-core:19.2.0-966.d18d54aa3.focal}
image: ${CORE_IMAGE:-stellar/stellar-core:19.3.0-1006.9ce6dc4e9.focal}
depends_on:
- core-postgres
restart: on-failure
Expand Down
18 changes: 16 additions & 2 deletions services/horizon/internal/ingest/filters/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package filters

import (
"context"
"sync"
"time"

"github.com/stellar/go/services/horizon/internal/db2/history"
Expand All @@ -13,9 +14,22 @@ var (

// the filter config cache will be checked against latest from db at most once per each of this interval.
//lint:ignore ST1011, don't need the linter warn on literal assignment
FilterConfigCheckIntervalSeconds time.Duration = 100
filterConfigCheckIntervalSeconds time.Duration = 100
filterConfigCheckIntervalSecondsLock sync.RWMutex
)

func GetFilterConfigCheckIntervalSeconds() time.Duration {
filterConfigCheckIntervalSecondsLock.RLock()
defer filterConfigCheckIntervalSecondsLock.RUnlock()
return filterConfigCheckIntervalSeconds
}

func SetFilterConfigCheckIntervalSeconds(t time.Duration) {
filterConfigCheckIntervalSecondsLock.Lock()
defer filterConfigCheckIntervalSecondsLock.Unlock()
filterConfigCheckIntervalSeconds = t
}

var (
LOG = log.WithFields(log.F{
"filters": "load",
Expand Down Expand Up @@ -43,7 +57,7 @@ func NewFilters() Filters {
// rebuild the list on expiration time interval. Method is NOT thread-safe.
func (f *filtersCache) GetFilters(filterQ history.QFilter, ctx context.Context) []processors.LedgerTransactionFilterer {
// only attempt to refresh filter config cache state at configured interval limit
if time.Now().Unix() < (f.lastFilterConfigCheckUnixEpoch + int64(FilterConfigCheckIntervalSeconds.Seconds())) {
if time.Now().Unix() < (f.lastFilterConfigCheckUnixEpoch + int64(GetFilterConfigCheckIntervalSeconds().Seconds())) {
return f.convertCacheToList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestFilteringAccountWhiteList(t *testing.T) {
tt.NoError(err)

// Setup a whitelisted account rule, force refresh of filter configs to be quick
filters.FilterConfigCheckIntervalSeconds = 1
filters.SetFilterConfigCheckIntervalSeconds(1)

expectedAccountFilter := hProtocol.AccountFilterConfig{
Whitelist: []string{whitelistedAccount.GetAccountID()},
Expand All @@ -64,7 +64,7 @@ func TestFilteringAccountWhiteList(t *testing.T) {
tt.Equal(expectedAccountFilter.Enabled, accountFilter.Enabled)

// Ensure the latest filter configs are reloaded by the ingestion state machine processor
time.Sleep(time.Duration(filters.FilterConfigCheckIntervalSeconds) * time.Second)
time.Sleep(time.Duration(filters.GetFilterConfigCheckIntervalSeconds()) * time.Second)

// Make sure that when using a non-whitelisted account, the transaction is not stored
txResp = itest.MustSubmitOperations(itest.MasterAccount(), itest.Master(),
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestFilteringAssetWhiteList(t *testing.T) {
tt.NoError(err)

// Setup a whitelisted asset rule, force refresh of filters to be quick
filters.FilterConfigCheckIntervalSeconds = 1
filters.SetFilterConfigCheckIntervalSeconds(1)

asset, err := whitelistedAsset.ToXDR()
tt.NoError(err)
Expand All @@ -141,7 +141,7 @@ func TestFilteringAssetWhiteList(t *testing.T) {
tt.Equal(expectedAssetFilter.Enabled, assetFilter.Enabled)

// Ensure the latest filter configs are reloaded by the ingestion state machine processor
time.Sleep(time.Duration(filters.FilterConfigCheckIntervalSeconds) * time.Second)
time.Sleep(time.Duration(filters.GetFilterConfigCheckIntervalSeconds()) * time.Second)

// Make sure that when using a non-whitelisted asset, the transaction is not stored
txResp = itest.MustSubmitOperations(itest.MasterAccount(), itest.Master(),
Expand Down