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

Added implicit PRUNE mode warning & Handling invalid data-storage-mode file #8369

Merged
merged 7 commits into from
Jun 18, 2024

Conversation

lucassaldanha
Copy link
Member

@lucassaldanha lucassaldanha commented Jun 12, 2024

PR Description

  • Handling error when data-storage-mode.txt file is invalid/empty/corrupt, including a manual step the user can execute to fix it.
  • Added deprecation warning for implicit PRUNE data storage mode.

WARNING
In the next release, Teku will stop supporting implicit PRUNE database storage mode configuration. If you want to keep using PRUNE mode, you must update your config file or CLI options with --data-storage-mode=PRUNE

Fixed Issue(s)

fixes #8357

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@lucassaldanha lucassaldanha changed the title Handling invalid data-storage-mode file Add implicit PRUNE mode warning & Handling invalid data-storage-mode file Jun 12, 2024
@lucassaldanha lucassaldanha changed the title Add implicit PRUNE mode warning & Handling invalid data-storage-mode file Added implicit PRUNE mode warning & Handling invalid data-storage-mode file Jun 12, 2024
CHANGELOG.md Outdated
@@ -5,6 +5,7 @@
- Next release will introduce a breaking change to Teku's metrics. This is due to some metrics changing names after a library upgrade.
We recommend all users of the `Teku - Detailed` dashboard to upgrade to version [Revision 12](https://grafana.com/api/dashboards/16737/revisions/12/download)
as soon as possible. Documentation with all metrics that have been renamed will be provided.
- Next release will stop supporting implicit PRUNE database storage mode configuration. If you want to keep using PRUNE mode, you must update your config file or CLI options with --data-storage-mode=PRUNE.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's difficult to understand. Maybe focus on default behavior changing from PRUNE to MINIMAL unless explicitely configured something else ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is specifically focussed on what we need users to do, im not sure we can make it easier to understand without saying

From the next release, you will need to explicitly set `--data-storage-mode=(prune|archive)` unless you're using minimal data-storage-mode (which is default behaviour)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your version more. Some users don't even know which mode they are using and what is the difference

print(
"Prune mode being used as default without a explicit --data-storage-mode option. This will NOT be "
+ "supported in future Teku versions. Please add --data-storage-mode=prune to your CLI arguments"
+ " or config file.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. if you want to keep it"?

dataDirLayout.getBeaconDataDirectory().toFile().exists(),
getStorageModeFromPersistedDatabase(dataDirLayout),
dataStorageMode);
beaconDataDirectory.toFile().exists(), storageModeFromStoredFile, dataStorageMode);
} else {
if (dataStorageMode.equals(NOT_SET)) {
dataStorageMode = PRUNE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this, it defaults to PRUNE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If next one answer is "YES", this one is clear. Do we need to print warn here too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I think I can clear this up... I don't think there is a code path where dataConfig will ever be null. So this else should never happen in production.


if (isExistingStore) {
STATUS_LOG.warnUsageOfImplicitPruneDataStorageMode();
return PRUNE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we wll change this behavior in another release, right?

Copy link
Member Author

@lucassaldanha lucassaldanha Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct: #8371

}
} catch (IOException e) {
LOG.error("Failed to read storage mode file", e);
}

return maybeConfiguredStorageMode.orElse(StateStorageMode.DEFAULT_MODE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method name is getStateStorageModeFromConfigOrDisk, but we read only for config actually and warn if persisted doesn't match. Maybe rename method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I am thinking about it, we can probably get rid of this method... There is no point in warning about this anymore as we are planning to get rid of this behaviour soon... Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we print actually used, we don't use file info here, so it makes sense (to clean it)

if (maybeStorageModeFromFile.isPresent() && maybeConfiguredStorageMode.isPresent()) {
if (!maybeStorageModeFromFile.get().equals(maybeConfiguredStorageMode.get())) {
LOG.info(
"Storage mode that was persisted differs from the command specified option; file: {}, CLI: {}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to see here which one will be actually used. And maybe it should be warn?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have another log line that says what data storage mode is being used. Not sure if there is value in adding it here as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this one is called on init, another one later will log actual

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM check tests pls

@lucassaldanha lucassaldanha merged commit 437da16 into Consensys:master Jun 18, 2024
16 checks passed
@lucassaldanha lucassaldanha deleted the teku-8357 branch July 31, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Startup error: No enum constant tech.pegasys.teku.storage.server.StateStorageMode
3 participants