Przeglądaj źródła

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 lat temu
rodzic
commit
41a557b915
1 zmienionych plików z 9 dodań i 1 usunięć
  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)
 	}