Upgrade restriction

We are using OpenZeppelin's library for our proxy pattern.
Just want to double-check on the restriction on the new version of the contract.
It is mentioned here that
https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#modifying-your-contracts
we cannot change the order in which the contract state variables are declared, nor their type.

Is mapping, struct or dynamic-sized array considered at state variables? Is it safe to append the new variables before a mapping (or arrary)?

i.e.

contract ImplementationA {
     uint256 a;
     uint256 constant b;

     struct someStruct {
        ...;
        ...;
     }
     [some mappings]
     [some dynamic-size arrays]
}
contract ImplementationB {
     uint256 a;
     uint256 constant b;
     uint256 newVariable;

     struct someStruct {
        ...;
        ...;
     }
     [some mappings]
     [some dynamic-size arrays]
}

Is upgrading from ImplementationA to ImplementationB safe?

Hi @David_Zhao, the struct declaration itself is not a state variable. However, the above is not upgrade safe because newVariable causes the mappings and dynamically-sized arrays to get moved. The content location of mappings and dynamically-sized arrays are based on the Keccak-256 hash of the slot number where the mapping or array is defined (see Solidity doc). So inserting a variable above causes the contents to be moved to a completely different location.