skoppu22 commented on code in PR #185: URL: https://github.com/apache/cassandra-analytics/pull/185#discussion_r2976293904
########## cassandra-analytics-integration-tests/src/test/java/org/apache/cassandra/analytics/CassandraAnalyticsSimpleBtiTest.java: ########## @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cassandra.analytics; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.cassandra.testing.ClusterBuilderConfiguration; + +/** + * A simple test that runs a sample read/write Cassandra Analytics job using BTI format SSTable. + */ +class CassandraAnalyticsSimpleBtiTest extends CassandraAnalyticsSimpleTest Review Comment: Can you please read sstables after bulk write and verify files have bti da format in file name? I have a draft of this ``` /** * Verifies that all SSTable data files across all nodes in the cluster use the BTI format (bti-da). * BTI format data files follow the naming pattern: {@code da-<generation>-bti-Data.db} */ private void verifySSTableFormat() { boolean foundDataFiles = false; for (int i = 1; i <= cluster.size(); i++) { if (cluster.get(i).isShutdown()) { continue; } Set<String> dataFileNames = findSSTableDataFiles(i); for (String fileName : dataFileNames) { foundDataFiles = true; assertThat(fileName) .as("SSTable data file should be in BTI format (bti-da) on node %d: %s", i, fileName) .contains("-bti-"); // Verify the version component is 'da' for Cassandra 5.0 BTI format assertThat(fileName) .as("SSTable data file should have version 'da' for Cassandra 5.0 BTI format on node %d: %s", i, fileName) .matches("da-\\d+-bti-Data\\.db"); } } assertThat(foundDataFiles) .as("Expected to find SSTable data files on at least one node") .isTrue(); } /** * Finds all SSTable data files for the test table on the given cluster node. * * @param nodeIndex the 1-based node index in the cluster * @return set of data file names found */ private Set<String> findSSTableDataFiles(int nodeIndex) { String[] dataDirs = (String[]) cluster.get(nodeIndex) .config() .getParams() .get("data_file_directories"); String dataDir = dataDirs[0]; Path keyspacePath = Paths.get(dataDir, TEST_KEYSPACE); if (!Files.exists(keyspacePath)) { return Collections.emptySet(); } try (Stream<Path> walkStream = Files.walk(keyspacePath)) { return walkStream .filter(Files::isRegularFile) .map(path -> path.getFileName().toString()) .filter(name -> name.endsWith("-Data.db")) .collect(Collectors.toSet()); } catch (IOException e) { throw new RuntimeException("Failed to list SSTable data files on node " + nodeIndex, e); } } ``` -- 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]
