smiklosovic commented on code in PR #3046:
URL: https://github.com/apache/cassandra/pull/3046#discussion_r1452208440


##########
src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java:
##########
@@ -618,6 +653,29 @@ public CQLSSTableWriter build()
                     Types types = createTypes(keyspaceName);
                     
Schema.instance.transform(SchemaTransformations.addTypes(types, true));
                     tableMetadata = createTable(types);
+
+                    Keyspace.setInitialized();
+
+                    if (buildIndexes && !indexStatements.isEmpty())
+                    {
+                        tableMetadata = 
applyIndexes(ksm.withSwapped(ksm.tables.with(tableMetadata)));
+                        Keyspace ks = 
Keyspace.openWithoutSSTables(keyspaceName);
+                        Directories directories = new 
Directories(tableMetadata, Collections.singleton(new DataDirectory(new 
File(directory.toPath()))));
+                        ColumnFamilyStore cfs = 
ColumnFamilyStore.createColumnFamilyStore(ks,
+                                                                               
           tableMetadata.name,
+                                                                               
           TableMetadataRef.forOfflineTools(tableMetadata),
+                                                                               
           directories,
+                                                                               
           false,
+                                                                               
           false,
+                                                                               
           true);
+                        ks.initCfCustom(cfs);
+
+                        // this is the empty directory / leftover from times 
we initialized ColumnFamilyStore
+                        // it will automatically create directories for 
keyspace and table on disk after initialization
+                        // we set that directory to the destination of 
generated SSTables so we just remove empty directories here
+                        new File(directory, keyspaceName).deleteRecursive();

Review Comment:
   I put this back.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to