瀏覽代碼

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.Columns[col.Name] = col
 		table.OrderedColumns = append(table.OrderedColumns, col.Name)
 		table.OrderedColumns = append(table.OrderedColumns, col.Name)
 	}
 	}