Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-11287

RocksDBListState should use actual registered state serializer instead of serializer provided by descriptor

    XMLWordPrintableJSON

Details

    Description

      Currently, when creating a RocksDBListState, the element serializer wrapped by the RocksDBListState is retrieved from the state descriptor:

      static <E, K, N, SV, S extends State, IS extends S> IS create(
          StateDescriptor<S, SV> stateDesc,
          Tuple2<ColumnFamilyHandle, RegisteredKeyValueStateBackendMetaInfo<N, SV>> registerResult,
          RocksDBKeyedStateBackend<K> backend) {
      
          return (IS) new RocksDBListState<>(
              registerResult.f0,
              registerResult.f1.getNamespaceSerializer(),
              (TypeSerializer<List<E>>) registerResult.f1.getStateSerializer(),
              (List<E>) stateDesc.getDefaultValue(),
              ((ListStateDescriptor<E>) stateDesc).getElementSerializer(), // incorrect
              backend);
      }
      

      This is incorrect, since new serializers retrieved from state descriptors have not been checked for compatibility with restored state.

      Instead, the element serializer should be retrieved from the register result, which contains the actual state serializer registered in the state backend for state access (and has already been checked for compatibility / reconfigured appropriately).

      Attachments

        Issue Links

          Activity

            People

              tzulitai Tzu-Li (Gordon) Tai
              tzulitai Tzu-Li (Gordon) Tai
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m