Skip to content

Commit

Permalink
Merge branch 'refactor-catchpoint-storing-config' into introduce-dht
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Warehime committed Sep 5, 2023
2 parents e5a8aec + 89ef9ab commit fa24be2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 0 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ const MaxGenesisIDLen = 128
// MaxEvalDeltaTotalLogSize is the maximum size of the sum of all log sizes in a single eval delta.
const MaxEvalDeltaTotalLogSize = 1024

// ForceCatchpointFileGenerationTrackingMode defines the CatchpointTracking mode that would be used to
// force a node to generate catchpoint files.
const ForceCatchpointFileGenerationTrackingMode = 99

// CatchpointTrackingModeUntracked defines the CatchpointTracking mode that does _not_ track catchpoints
const CatchpointTrackingModeUntracked = -1

Expand Down
10 changes: 5 additions & 5 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,15 +884,15 @@ func TestStoresCatchpoints(t *testing.T) {
expected: true,
},
{
name: "ForceCatchpointFileGenerationTrackingMode expects true",
catchpointTracking: ForceCatchpointFileGenerationTrackingMode,
name: "99 expects false",
catchpointTracking: 99,
catchpointInterval: GetDefaultLocal().CatchpointInterval,
archival: GetDefaultLocal().Archival,
expected: true,
expected: false,
},
{
name: "ForceCatchpointFileGenerationTrackingMode w/ catchpointInterval=0 expects false",
catchpointTracking: ForceCatchpointFileGenerationTrackingMode,
name: "99 w/ catchpointInterval=0 expects false",
catchpointTracking: 99,
catchpointInterval: 0,
archival: GetDefaultLocal().Archival,
expected: false,
Expand Down
5 changes: 2 additions & 3 deletions config/localTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ type Local struct {
// A value of 1 means "track catchpoints as long as CatchpointInterval > 0".
// A value of 2 means "track catchpoints and always generate catchpoint files as long as CatchpointInterval > 0".
// A value of 0 means automatic, which is the default value. In this mode, a non archival node would not track the catchpoints, and an archival node would track the catchpoints as long as CatchpointInterval > 0.
// A value of 99 will force the node to generate catchpoint files
// Other values of CatchpointTracking would give a warning in the log file, and would behave as if the default value was provided.
// Other values of CatchpointTracking would behave as if the default value was provided.
CatchpointTracking int64 `version[11]:"0"`

// LedgerSynchronousMode defines the synchronous mode used by the ledger database. The supported options are:
Expand Down Expand Up @@ -881,7 +880,7 @@ func (cfg *Local) StoresCatchpoints() bool {
if cfg.Archival {
return true
}
case CatchpointTrackingModeStored, ForceCatchpointFileGenerationTrackingMode:
case CatchpointTrackingModeStored:
return true
}
return false
Expand Down
4 changes: 4 additions & 0 deletions ledger/acctupdates.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ const initializingAccountCachesMessageTimeout = 3 * time.Second
// where we end up batching up to 1000 rounds in a single update.
const accountsUpdatePerRoundHighWatermark = 1 * time.Second

// forceCatchpointFileGenerationTrackingMode defines the CatchpointTracking mode that would be used to
// force a node to generate catchpoint files.
const forceCatchpointFileGenerationTrackingMode = 99

// A modifiedAccount represents an account that has been modified since
// the persistent state stored in the account DB (i.e., in the range of
// rounds covered by the accountUpdates tracker).
Expand Down
8 changes: 7 additions & 1 deletion ledger/catchpointtracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ func (ct *catchpointTracker) initialize(cfg config.Local, paths DirsAndPrefix) {
ct.catchpointInterval = cfg.CatchpointInterval
}
ct.enableGeneratingCatchpointFiles = cfg.StoresCatchpoints()
ct.forceCatchpointFileWriting = cfg.CatchpointTracking == config.ForceCatchpointFileGenerationTrackingMode

// Overwrite previous options if forceCatchpointFileGenerationTrackingMode
if cfg.CatchpointTracking == forceCatchpointFileGenerationTrackingMode && cfg.CatchpointInterval > 0 {
ct.catchpointInterval = cfg.CatchpointInterval
ct.forceCatchpointFileWriting = true
ct.enableGeneratingCatchpointFiles = true
}

ct.catchpointFileHistoryLength = cfg.CatchpointFileHistoryLength
if cfg.CatchpointFileHistoryLength < -1 {
Expand Down

0 comments on commit fa24be2

Please sign in to comment.