Elffuss BraidHub

kikocis/java-driver public

Handle UDTs when updating keyspaces + remove unused parameters.
Changesetb60572d5df2d0c64d2ab7cbd220fff905360ba4c858b01a2868bd75443c4d342
Authorolim7t <omichallat+github@gmail.com> · 2015-09-17 02:43 +02:00
Committerolim7t <omichallat+github@gmail.com> · 2015-09-29 16:40 -07:00
Parents547223707403

Browse the files at this changeset

1 file changed

modified driver-core/src/main/java/com/datastax/driver/core/Metadata.java +6 −7
@@ -28,8 +28,6 @@
2828 import org.slf4j.Logger;
2929 import org.slf4j.LoggerFactory;
3030
31-import com.datastax.driver.core.exceptions.DriverInternalError;
32-
3331 import static com.datastax.driver.core.SchemaElement.KEYSPACE;
3432 import static com.datastax.driver.core.SchemaElement.TABLE;
3533 import static com.datastax.driver.core.SchemaElement.TYPE;
@@ -88,7 +86,7 @@
8886 return;
8987 }
9088 if (udtRows.containsKey(targetKeyspace)) {
91- Map<String, UserType> userTypes = buildUserTypes(keyspace, udtRows.get(targetKeyspace), cassandraVersion);
89+ Map<String, UserType> userTypes = buildUserTypes(udtRows.get(targetKeyspace));
9290 updateUserTypes(keyspace.userTypes, userTypes, targetName);
9391 }
9492 }
@@ -147,7 +145,7 @@
147145 for (TableMetadata table : tables.values()) {
148146 keyspace.add(table);
149147 }
150- Map<String, UserType> userTypes = buildUserTypes(keyspace, udtRows.get(keyspace.getName()), cassandraVersion);
148+ Map<String, UserType> userTypes = buildUserTypes(udtRows.get(keyspace.getName()));
151149 for (UserType userType : userTypes.values()) {
152150 keyspace.add(userType);
153151 }
@@ -195,7 +193,7 @@
195193 return tables;
196194 }
197195
198- private Map<String, UserType> buildUserTypes(KeyspaceMetadata keyspace, List<Row> udtRows, VersionNumber cassandraVersion) {
196+ private Map<String, UserType> buildUserTypes(List<Row> udtRows) {
199197 Map<String, UserType> userTypes = new LinkedHashMap<String, UserType>();
200198 if (udtRows != null) {
201199 for (Row udtRow : udtRows) {
@@ -237,8 +235,9 @@
237235 triggerOnKeyspaceChanged(newKeyspace, oldKeyspace);
238236 }
239237 Map<String, TableMetadata> oldTables = oldKeyspace == null ? new HashMap<String, TableMetadata>() : oldKeyspace.tables;
240- Map<String, TableMetadata> newTables = newKeyspace.tables;
241- updateTables(oldTables, newTables, null);
238+ updateTables(oldTables, newKeyspace.tables, null);
239+ Map<String, UserType> oldTypes = oldKeyspace == null ? new HashMap<String, UserType>() : oldKeyspace.userTypes;
240+ updateUserTypes(oldTypes, newKeyspace.userTypes, null);
242241 }
243242 }
244243