@@ -2144,3 +2144,118 @@ message TSerializedEvent {
21442144 // TEventSerializationInfo::IsExtendedFormat flag
21452145 optional bool IsExtendedFormat = 2 ;
21462146}
2147+
2148+ // In-memory variables that are important to restore between shard generations
2149+ message TInMemoryVars {
2150+ optional NKikimrProto.TRowVersion ImmediateWriteEdge = 1 ;
2151+ optional NKikimrProto.TRowVersion ImmediateWriteEdgeReplied = 2 ;
2152+ optional NKikimrProto.TRowVersion UnprotectedReadEdge = 3 ;
2153+ }
2154+
2155+ // In-memory locks
2156+ message TInMemoryLockInfo {
2157+ optional uint64 LockId = 1 ;
2158+ optional uint32 LockNodeId = 2 ;
2159+ optional uint32 Generation = 3 ;
2160+ optional uint32 Counter = 4 ;
2161+ optional uint64 CreateTs = 5 ;
2162+ optional uint64 Flags = 6 ;
2163+ optional NKikimrProto.TRowVersion BreakVersion = 7 ;
2164+ repeated NKikimrProto.TPathID ReadTables = 8 ;
2165+ repeated NKikimrProto.TPathID WriteTables = 9 ;
2166+ }
2167+
2168+ // In-memory ranges associated with the lock
2169+ // Note: whole shard locks will have whole table read/write ranges
2170+ message TInMemoryLockRange {
2171+ optional uint64 LockId = 1 ;
2172+ optional NKikimrProto.TPathID TableId = 2 ;
2173+ optional uint64 Flags = 3 ;
2174+ optional bytes Data = 4 ;
2175+ }
2176+
2177+ // In-memory conflicts between locks
2178+ message TInMemoryLockConflict {
2179+ // When this lock is committed
2180+ optional uint64 LockId = 1 ;
2181+ // It must break another lock with the specified id
2182+ optional uint64 ConflictId = 2 ;
2183+ }
2184+
2185+ // In-memory volatile dependencies
2186+ // This specifies that to commit this lock we must use a volatile transaction
2187+ // that must have a dependency on the specified TxId.
2188+ message TInMemoryLockVolatileDependency {
2189+ optional uint64 LockId = 1 ;
2190+ optional uint64 TxId = 2 ;
2191+ }
2192+
2193+ // In-memory prepared volatile transactions, i.e. those we have accepted for
2194+ // execution and may be planned and executed later. This includes planned and
2195+ // acknowledged transactions that haven't executed yet (including those that
2196+ // have not been committed yet?)
2197+ message TInMemoryPreparedVolatileTx {
2198+ optional uint64 TxId = 1 ;
2199+ optional NActorsProto.TActorId Source = 2 ;
2200+ optional uint64 Cookie = 3 ;
2201+ optional uint64 Type = 4 ;
2202+ optional bytes Body = 5 ;
2203+ optional uint64 Flags = 6 ;
2204+ // This is Min/Max step of a prepared transactions, mostly used for deadline cleanup
2205+ optional uint64 MinStep = 7 ;
2206+ optional uint64 MaxStep = 8 ;
2207+ // Specified when the transaction has been planned already (including predictions)
2208+ optional uint64 PredictedStep = 9 ;
2209+ optional uint64 Step = 10 ;
2210+ }
2211+
2212+ // In-memory waiting volatile transactions, i.e. those that have not been
2213+ // decided yet (at least persistently), and for which we need to send a
2214+ // result when they eventually commit or abort. This is matched against
2215+ // transactions that are restored from disk.
2216+ message TInMemoryWaitingVolatileTx {
2217+ optional uint64 TxId = 1 ;
2218+ optional NActorsProto.TActorId Source = 2 ;
2219+ optional uint64 Cookie = 3 ;
2220+ optional uint64 Type = 4 ;
2221+ }
2222+
2223+ // Partial in-memory state of the datashard
2224+ message TInMemoryState {
2225+ optional TInMemoryVars Vars = 1 ;
2226+ repeated TInMemoryLockInfo Locks = 2 ;
2227+ repeated TInMemoryLockRange LockRanges = 3 ;
2228+ repeated TInMemoryLockConflict LockConflicts = 4 ;
2229+ repeated TInMemoryLockVolatileDependency LockVolatileDependencies = 5 ;
2230+ repeated TInMemoryPreparedVolatileTx PreparedVolatileTxs = 6 ;
2231+ repeated TInMemoryWaitingVolatileTx WaitingVolatileTxs = 7 ;
2232+ }
2233+
2234+ // Internal continuation token, may change between versions
2235+ message TInMemoryStateContinuationToken {
2236+ // Index to continue from
2237+ optional uint64 NextIndex = 1 ;
2238+ }
2239+
2240+ // Sent to the state actor by new generations
2241+ message TEvInMemoryStateRequest {
2242+ // Generation of the new tablet
2243+ optional uint32 Generation = 1 ;
2244+
2245+ // Continuation token to get the next response
2246+ optional bytes ContinuationToken = 2 ;
2247+ }
2248+
2249+ // Sent by the state actor to new generations
2250+ message TEvInMemoryStateResponse {
2251+ // Partial serialized TInMemoryState chunk
2252+ optional uint32 SerializedStatePayloadIndex = 1 ;
2253+
2254+ // Optional checkpoint offsets within the chunk. The protobuf message may
2255+ // be parsed cleanly up to these offsets without the need to concatenate
2256+ // subsequent chunks.
2257+ repeated uint32 SerializedStateCheckpoints = 2 [packed = true ];
2258+
2259+ // Will be set for incomplete replies
2260+ optional bytes ContinuationToken = 3 ;
2261+ }
0 commit comments