@@ -1087,8 +1087,8 @@ func (fsh *StorageHandler) CommitWriteV2(ctx context.Context, r *http.Request) (
1087
1087
"Invalid chain size. expected:%v got %v" , connectionObj .Size , writeMarker .ChainSize )
1088
1088
}
1089
1089
1090
- allocationRoot := hex .EncodeToString (trie .Root ())
1091
- fileMetaRoot := allocationRoot
1090
+ fileMetaRoot := hex .EncodeToString (trie .Root ())
1091
+ allocationRoot := encryption . Hash ( fileMetaRoot + allocationID )
1092
1092
if allocationRoot != writeMarker .AllocationRoot {
1093
1093
result .AllocationRoot = allocationObj .AllocationRoot
1094
1094
if latestWriteMarkerEntity != nil {
@@ -1122,6 +1122,7 @@ func (fsh *StorageHandler) CommitWriteV2(ctx context.Context, r *http.Request) (
1122
1122
db := datastore .GetStore ().GetTransaction (ctx )
1123
1123
writemarkerEntity .Latest = true
1124
1124
if err = db .Create (writemarkerEntity ).Error ; err != nil {
1125
+ logging .Logger .Error ("write_marker_error" , zap .String ("allocation_id" , allocationID ), zap .Error (err ))
1125
1126
return nil , common .NewError ("write_marker_error" , "Error persisting the write marker" )
1126
1127
}
1127
1128
allocationObj .AllocationRoot = allocationRoot
@@ -2020,8 +2021,8 @@ func (fsh *StorageHandler) Rollback(ctx context.Context, r *http.Request) (*blob
2020
2021
}
2021
2022
if trie != nil {
2022
2023
var node wmpt.Node
2023
- if len (allocationRoot ) > 0 {
2024
- decodedRoot , _ := hex .DecodeString (allocationRoot )
2024
+ if len (fileMetaRoot ) > 0 {
2025
+ decodedRoot , _ := hex .DecodeString (fileMetaRoot )
2025
2026
node = wmpt .NewHashNode (decodedRoot , alloc .NumBlocks )
2026
2027
}
2027
2028
trie .RollbackTrie (node )
0 commit comments