Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Change SlotMeta is_connected bool to bitflags #29001

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

steviez
Copy link
Contributor

@steviez steviez commented Nov 30, 2022

Problem

We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true.

Summary of Changes

In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.

@steviez steviez mentioned this pull request Nov 30, 2022
8 tasks
@steviez steviez marked this pull request as ready for review November 30, 2022 22:47
@steviez steviez force-pushed the connected_flags branch 3 times, most recently from 8d68ff3 to 80e008f Compare November 30, 2022 23:23
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

just a few nits from me. agreed that this should be sufficient and the proposed custom deserializer to retain the bool typification here is unnecesary

ledger/src/blockstore_meta.rs Show resolved Hide resolved
ledger/src/blockstore_meta.rs Outdated Show resolved Hide resolved
ledger/src/blockstore_meta.rs Show resolved Hide resolved
ledger/src/blockstore_meta.rs Outdated Show resolved Hide resolved
We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.
@steviez
Copy link
Contributor Author

steviez commented Dec 1, 2022

Also, I'm thinking backport to v1.13 and v1.14; agreed @t-nelson ?

Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

Also, I'm thinking backport to v1.13 and v1.14; agreed @t-nelson ?

yep! :shipit:

Copy link
Contributor

@yhchiang-sol yhchiang-sol left a comment

Choose a reason for hiding this comment

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

Looks good! Much cleaner now!

Maybe consider adding one test case that covers the slot 0 case?

ledger/src/blockstore_meta.rs Show resolved Hide resolved
ledger/src/blockstore_meta.rs Show resolved Hide resolved
ledger/src/blockstore_meta.rs Show resolved Hide resolved
@steviez steviez merged commit 01cd55a into solana-labs:master Dec 1, 2022
@steviez steviez deleted the connected_flags branch December 1, 2022 20:42
mergify bot pushed a commit that referenced this pull request Dec 1, 2022
We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.

(cherry picked from commit 01cd55a)

# Conflicts:
#	ledger/src/blockstore.rs
#	ledger/src/blockstore_meta.rs
mergify bot pushed a commit that referenced this pull request Dec 1, 2022
We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.

(cherry picked from commit 01cd55a)

# Conflicts:
#	ledger/src/blockstore.rs
mergify bot added a commit that referenced this pull request Dec 1, 2022
* Change SlotMeta is_connected bool to bitflags (#29001)

We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.

(cherry picked from commit 01cd55a)

# Conflicts:
#	ledger/src/blockstore.rs
#	ledger/src/blockstore_meta.rs

* Resolve auto-merge failures

Co-authored-by: steviez <steven@solana.com>
mergify bot added a commit that referenced this pull request Dec 1, 2022
* Change SlotMeta is_connected bool to bitflags (#29001)

We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.

(cherry picked from commit 01cd55a)

# Conflicts:
#	ledger/src/blockstore.rs

* Resolve auto-merge failures

Co-authored-by: steviez <steven@solana.com>
gnapoli23 pushed a commit to gnapoli23/solana that referenced this pull request Dec 16, 2022
We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.
nickfrosty pushed a commit to nickfrosty/solana that referenced this pull request Jan 4, 2023
We currently use the is_connected field to be able to signal to
ReplayStage that a slot has replayable updates. It was discovered that
this functionality is effectively broken, and that is_connected is never
true. In order to convey this information to ReplayStage more
effectively, we need extra state information so this PR changes the
existing bool to bitflags with two bits.

From a compatibility standpoint, the is_connected bool was already
occupying one byte in the serialized SlotMeta in blockstore. Thus, the
change from a bool to bitflags still "fits" in that one byte allotment.

In consideration of a case where a client may wish to downgrade software
and use the same ledger, deserializing the bitflags into a bool could
fail if the new bit is set. As such, this PR introduces the second bit
field, but does not set it anywhere. Once clusters have mass adopted a
software version with this PR, a subsequent change to actually set and
use the new field can be introduced.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants