Skip to content

Commit

Permalink
Merge pull request #7119 from paperstreet/family_formatversion
Browse files Browse the repository at this point in the history
sqlbase: allow FamilyFormatVersion in tabledesc validate
  • Loading branch information
danhhz committed Jun 9, 2016
2 parents ba658b3 + 84fb05d commit c17e77f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions sql/sqlbase/structured.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,13 @@ func (desc *TableDescriptor) Validate() error {
return fmt.Errorf("invalid parent ID %d", desc.ParentID)
}

if desc.GetFormatVersion() != BaseFormatVersion {
// TODO(dan): Once a beta with this check is released, update the reference
// tests with it as the new bidirectional compatibility version. Then remove
// support here for BaseFormatVersion.
if v := desc.GetFormatVersion(); v != BaseFormatVersion && v != FamilyFormatVersion {
return fmt.Errorf(
"table %q is encoded using using version %d, but this client only supports version %d",
desc.Name, desc.GetFormatVersion(), BaseFormatVersion)
"table %q is encoded using using version %d, but this client only supports version %d and %d",
desc.Name, desc.GetFormatVersion(), BaseFormatVersion, FamilyFormatVersion)
}

if len(desc.Columns) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion sql/sqlbase/structured_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestValidateTableDesc(t *testing.T) {
TableDescriptor{ID: 0, Name: "foo"}},
{`invalid parent ID 0`,
TableDescriptor{ID: 2, Name: "foo"}},
{`table "foo" is encoded using using version 0, but this client only supports version 1`,
{`table "foo" is encoded using using version 0, but this client only supports version 1 and 2`,
TableDescriptor{ID: 2, ParentID: 1, Name: "foo"}},
{`table must contain at least 1 column`,
TableDescriptor{
Expand Down

0 comments on commit c17e77f

Please sign in to comment.