go/libraries/doltcore/doltdb: durable/table: Always write the table value we are refing. Ensures it always makes it across the GC safepoint.

This commit is contained in:
Aaron Son
2023-03-31 14:45:39 -07:00
parent e30da05d8d
commit e4558453aa

View File

@@ -668,27 +668,7 @@ func (t nomsTable) DebugString(ctx context.Context) string {
}
func refFromNomsValue(ctx context.Context, vrw types.ValueReadWriter, val types.Value) (types.Ref, error) {
valRef, err := types.NewRef(val, vrw.Format())
if err != nil {
return types.Ref{}, err
}
targetVal, err := valRef.TargetValue(ctx, vrw)
if err != nil {
return types.Ref{}, err
}
if targetVal == nil {
_, err = vrw.WriteValue(ctx, val)
if err != nil {
return types.Ref{}, err
}
}
return valRef, err
return vrw.WriteValue(ctx, val)
}
func schemaFromRef(ctx context.Context, vrw types.ValueReadWriter, ref types.Ref) (schema.Schema, error) {