소스 검색

metadata: skip adding columns to tables which we dont have

Ff the schema is being updated we will race between seeing
the metadata be complete. Potentially we should check for
schema versions before and after reading the metadata and
if they dont match try again.
Chris Bannister 7 년 전
부모
커밋
41a557b915
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      metadata.go

+ 9 - 1
metadata.go

@@ -243,7 +243,15 @@ func compileMetadata(
 			}
 		}
 
-		table := keyspace.Tables[col.Table]
+		table, ok := keyspace.Tables[col.Table]
+		if !ok {
+			// if the schema is being updated we will race between seeing
+			// the metadata be complete. Potentially we should check for
+			// schema versions before and after reading the metadata and
+			// if they dont match try again.
+			continue
+		}
+
 		table.Columns[col.Name] = col
 		table.OrderedColumns = append(table.OrderedColumns, col.Name)
 	}