diff --git a/go/libraries/doltcore/dbfactory/mem.go b/go/libraries/doltcore/dbfactory/mem.go index 6e982e545c..5d6dfec502 100644 --- a/go/libraries/doltcore/dbfactory/mem.go +++ b/go/libraries/doltcore/dbfactory/mem.go @@ -37,7 +37,7 @@ func (fact MemFactory) PrepareDB(ctx context.Context, nbf *types.NomsBinFormat, func (fact MemFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, tree.NodeStore, error) { var db datas.Database storage := &chunks.MemoryStorage{} - cs := storage.NewViewWithDefaultFormat() + cs := storage.NewViewWithFormat(nbf.VersionString()) vrw := types.NewValueStore(cs) ns := tree.NewNodeStore(cs) db = datas.NewTypesDatabase(vrw, ns) diff --git a/go/libraries/doltcore/table/editor/index_editor_test.go b/go/libraries/doltcore/table/editor/index_editor_test.go index 379bdec026..b648787112 100644 --- a/go/libraries/doltcore/table/editor/index_editor_test.go +++ b/go/libraries/doltcore/table/editor/index_editor_test.go @@ -52,8 +52,9 @@ var id2, _ = uuid.NewRandom() var id3, _ = uuid.NewRandom() func TestIndexEditorConcurrency(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, _, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) + require.Equal(t, format, vrw.Format()) require.NoError(t, err) colColl := schema.NewColCollection( schema.NewColumn("pk", 0, types.IntKind, true), @@ -147,8 +148,9 @@ func TestIndexEditorConcurrency(t *testing.T) { } func TestIndexEditorConcurrencyPostInsert(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, _, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) + require.Equal(t, format, vrw.Format()) require.NoError(t, err) colColl := schema.NewColCollection( schema.NewColumn("pk", 0, types.IntKind, true), @@ -239,8 +241,9 @@ func TestIndexEditorConcurrencyPostInsert(t *testing.T) { } func TestIndexEditorUniqueMultipleNil(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, _, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) + require.Equal(t, format, vrw.Format()) require.NoError(t, err) colColl := schema.NewColCollection( schema.NewColumn("pk", 0, types.IntKind, true), @@ -284,8 +287,9 @@ func TestIndexEditorUniqueMultipleNil(t *testing.T) { } func TestIndexEditorWriteAfterFlush(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, _, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) + require.Equal(t, format, vrw.Format()) require.NoError(t, err) colColl := schema.NewColCollection( schema.NewColumn("pk", 0, types.IntKind, true), @@ -352,8 +356,9 @@ func TestIndexEditorWriteAfterFlush(t *testing.T) { } func TestIndexEditorUniqueErrorDoesntPersist(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, _, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) + require.Equal(t, format, vrw.Format()) require.NoError(t, err) colColl := schema.NewColCollection( schema.NewColumn("pk", 0, types.IntKind, true), @@ -395,7 +400,8 @@ func TestIndexEditorUniqueErrorDoesntPersist(t *testing.T) { } func TestIndexRebuildingWithZeroIndexes(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) tSchema := createTestSchema(t) _, err := tSchema.Indexes().RemoveIndex(testSchemaIndexName) require.NoError(t, err) @@ -417,7 +423,8 @@ func TestIndexRebuildingWithZeroIndexes(t *testing.T) { } func TestIndexRebuildingWithOneIndex(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) tSchema := createTestSchema(t) _, err := tSchema.Indexes().RemoveIndex(testSchemaIndexAge) require.NoError(t, err) @@ -434,7 +441,7 @@ func TestIndexRebuildingWithOneIndex(t *testing.T) { require.True(t, ok) indexKey[tag] = val } - indexExpectedRows[i], err = row.New(types.Format_Default, indexSch, indexKey) + indexExpectedRows[i], err = row.New(types.Format_LD_1, indexSch, indexKey) require.NoError(t, err) } @@ -469,7 +476,8 @@ func TestIndexRebuildingWithOneIndex(t *testing.T) { } func TestIndexRebuildingWithTwoIndexes(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) tSchema := createTestSchema(t) indexName := tSchema.Indexes().GetByName(testSchemaIndexName) @@ -593,7 +601,8 @@ func TestIndexRebuildingWithTwoIndexes(t *testing.T) { } func TestIndexRebuildingUniqueSuccessOneCol(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) colColl := schema.NewColCollection( schema.NewColumn("pk1", 1, types.IntKind, true, schema.NotNullConstraint{}), schema.NewColumn("v1", 2, types.IntKind, false), @@ -623,7 +632,8 @@ func TestIndexRebuildingUniqueSuccessOneCol(t *testing.T) { } func TestIndexRebuildingUniqueSuccessTwoCol(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) colColl := schema.NewColCollection( schema.NewColumn("pk1", 1, types.IntKind, true, schema.NotNullConstraint{}), schema.NewColumn("v1", 2, types.IntKind, false), @@ -653,7 +663,8 @@ func TestIndexRebuildingUniqueSuccessTwoCol(t *testing.T) { } func TestIndexRebuildingUniqueFailOneCol(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) colColl := schema.NewColCollection( schema.NewColumn("pk1", 1, types.IntKind, true, schema.NotNullConstraint{}), schema.NewColumn("v1", 2, types.IntKind, false), @@ -683,7 +694,8 @@ func TestIndexRebuildingUniqueFailOneCol(t *testing.T) { } func TestIndexRebuildingUniqueFailTwoCol(t *testing.T) { - _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_Default, nil, nil) + _, vrw, ns, _ := dbfactory.MemFactory{}.CreateDB(context.Background(), types.Format_LD_1, nil, nil) + require.Equal(t, types.Format_LD_1, vrw.Format()) colColl := schema.NewColCollection( schema.NewColumn("pk1", 1, types.IntKind, true, schema.NotNullConstraint{}), schema.NewColumn("v1", 2, types.IntKind, false), @@ -717,8 +729,9 @@ func TestIndexRebuildingUniqueFailTwoCol(t *testing.T) { func TestIndexEditorCapacityExceeded(t *testing.T) { // In the event that we reach the iea capacity on Undo, we need to verify that all code paths fail and remain failing ctx := context.Background() - format := types.Format_Default + format := types.Format_LD_1 _, vrw, _, err := dbfactory.MemFactory{}.CreateDB(ctx, format, nil, nil) + require.Equal(t, format, vrw.Format()) require.NoError(t, err) colColl := schema.NewColCollection( schema.NewColumn("pk", 0, types.IntKind, true), @@ -801,7 +814,7 @@ func createTestRowDataFromTaggedValues(t *testing.T, vrw types.ValueReadWriter, ed := m.Edit() for i, val := range vals { - r, err := row.New(types.Format_Default, sch, val) + r, err := row.New(types.Format_LD_1, sch, val) require.NoError(t, err) rows[i] = r ed = ed.Set(r.NomsMapKey(sch), r.NomsMapValue(sch)) @@ -848,7 +861,7 @@ func rowsToIndexRows(t *testing.T, rows []row.Row, indexName schema.Index, index require.True(t, ok) indexNameKey[tag] = val } - indexNameExpectedRows[i], err = row.New(types.Format_Default, indexNameSch, indexNameKey) + indexNameExpectedRows[i], err = row.New(types.Format_LD_1, indexNameSch, indexNameKey) require.NoError(t, err) indexAgeKey := make(row.TaggedValues) @@ -857,7 +870,7 @@ func rowsToIndexRows(t *testing.T, rows []row.Row, indexName schema.Index, index require.True(t, ok) indexAgeKey[tag] = val } - indexAgeExpectedRows[i], err = row.New(types.Format_Default, indexAgeSch, indexAgeKey) + indexAgeExpectedRows[i], err = row.New(types.Format_LD_1, indexAgeSch, indexAgeKey) require.NoError(t, err) } return diff --git a/go/libraries/doltcore/table/editor/keyless_table_editor_test.go b/go/libraries/doltcore/table/editor/keyless_table_editor_test.go index 207c4c8d96..fd38a4b06f 100644 --- a/go/libraries/doltcore/table/editor/keyless_table_editor_test.go +++ b/go/libraries/doltcore/table/editor/keyless_table_editor_test.go @@ -30,7 +30,7 @@ import ( ) func TestKeylessTableEditorConcurrency(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) colColl := schema.NewColCollection( @@ -138,7 +138,7 @@ func TestKeylessTableEditorConcurrency(t *testing.T) { } func TestKeylessTableEditorConcurrencyPostInsert(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) colColl := schema.NewColCollection( @@ -245,7 +245,7 @@ func TestKeylessTableEditorConcurrencyPostInsert(t *testing.T) { } func TestKeylessTableEditorWriteAfterFlush(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) colColl := schema.NewColCollection( @@ -326,7 +326,7 @@ func TestKeylessTableEditorWriteAfterFlush(t *testing.T) { } func TestKeylessTableEditorDuplicateKeyHandling(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) colColl := schema.NewColCollection( @@ -416,7 +416,7 @@ func TestKeylessTableEditorDuplicateKeyHandling(t *testing.T) { func TestKeylessTableEditorMultipleIndexErrorHandling(t *testing.T) { ctx := context.Background() - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(ctx, format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) @@ -573,7 +573,7 @@ func TestKeylessTableEditorMultipleIndexErrorHandling(t *testing.T) { func TestKeylessTableEditorIndexCardinality(t *testing.T) { ctx := context.Background() - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(ctx, format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) diff --git a/go/libraries/doltcore/table/editor/pk_table_editor_test.go b/go/libraries/doltcore/table/editor/pk_table_editor_test.go index fc1b1a2c32..65639d2093 100644 --- a/go/libraries/doltcore/table/editor/pk_table_editor_test.go +++ b/go/libraries/doltcore/table/editor/pk_table_editor_test.go @@ -41,7 +41,7 @@ const ( ) func TestTableEditorConcurrency(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) @@ -136,7 +136,7 @@ func TestTableEditorConcurrency(t *testing.T) { } func TestTableEditorConcurrencyPostInsert(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) @@ -229,7 +229,7 @@ func TestTableEditorConcurrencyPostInsert(t *testing.T) { } func TestTableEditorWriteAfterFlush(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) @@ -303,7 +303,7 @@ func handleDuplicateKeyError(newKeyString, indexName string, existingKey, existi } func TestTableEditorDuplicateKeyHandling(t *testing.T) { - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(context.Background(), format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) @@ -382,7 +382,7 @@ func TestTableEditorDuplicateKeyHandling(t *testing.T) { func TestTableEditorMultipleIndexErrorHandling(t *testing.T) { ctx := context.Background() - format := types.Format_Default + format := types.Format_LD_1 _, vrw, ns, err := dbfactory.MemFactory{}.CreateDB(ctx, format, nil, nil) require.NoError(t, err) opts := TestEditorOptions(vrw) diff --git a/go/libraries/doltcore/table/editor/table_edit_accumulator_test.go b/go/libraries/doltcore/table/editor/table_edit_accumulator_test.go index 2f943d9a6f..19b5af42ed 100644 --- a/go/libraries/doltcore/table/editor/table_edit_accumulator_test.go +++ b/go/libraries/doltcore/table/editor/table_edit_accumulator_test.go @@ -25,7 +25,7 @@ import ( "github.com/dolthub/dolt/go/store/types" ) -var emptyTpl = types.EmptyTuple(types.Format_Default) +var emptyTpl = types.EmptyTuple(types.Format_LD_1) func newTestTEAF() *dbEaFactory { dir := os.TempDir() @@ -37,28 +37,28 @@ func newTestTEAF() *dbEaFactory { } func newTuple(t *testing.T, vals ...types.Value) types.Tuple { - tpl, err := types.NewTuple(types.Format_Default, vals...) + tpl, err := types.NewTuple(types.Format_LD_1, vals...) require.NoError(t, err) return tpl } func teaInsert(t *testing.T, tea TableEditAccumulator, key types.Tuple) { - h, err := key.Hash(types.Format_Default) + h, err := key.Hash(types.Format_LD_1) require.NoError(t, err) tea.Insert(h, key, emptyTpl) } func teaDelete(t *testing.T, tea TableEditAccumulator, key types.Tuple) { - h, err := key.Hash(types.Format_Default) + h, err := key.Hash(types.Format_LD_1) require.NoError(t, err) tea.Delete(h, key) } func requireGet(ctx context.Context, t *testing.T, tea TableEditAccumulator, key types.Tuple, expected bool) { - h, err := key.Hash(types.Format_Default) + h, err := key.Hash(types.Format_LD_1) require.NoError(t, err) _, has, err := tea.Get(ctx, h, key) require.NoError(t, err) @@ -73,7 +73,7 @@ func TestIndexEditAccumulatorStableOrder(t *testing.T) { indexFlushThreshold = 1 ctx := context.Background() - nbf := types.Format_Default + nbf := types.Format_LD_1 teaf := newTestTEAF() m, err := types.NewMap(ctx, teaf.vrw) require.NoError(t, err) @@ -117,7 +117,7 @@ func TestTableEditAccumulatorStableOrder(t *testing.T) { flushThreshold = 2 ctx := context.Background() - nbf := types.Format_Default + nbf := types.Format_LD_1 teaf := newTestTEAF() m, err := types.NewMap(ctx, teaf.vrw) require.NoError(t, err) @@ -151,7 +151,7 @@ func TestTableEditAccumulatorStableOrder(t *testing.T) { func TestGet(t *testing.T) { ctx := context.Background() - nbf := types.Format_Default + nbf := types.Format_LD_1 teaf := newTestTEAF() m, err := types.NewMap(ctx, teaf.vrw) require.NoError(t, err)