forked from opendistro-for-elasticsearch/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opendistro-for-elasticsearch#10 from rupal-bq/benc…
…hmarking add cassandra database launcher
- Loading branch information
Showing
6 changed files
with
197 additions
and
1 deletion.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...istroforelasticsearch/sql/benchmark/utils/launch/cassandra/CassandraDatabaseLauncher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 com.amazon.opendistroforelasticsearch.sql.benchmark.utils.launch.cassandra; | ||
|
||
import static com.amazon.opendistroforelasticsearch.sql.benchmark.utils.CommandExecution.executeCommand; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.launch.DatabaseLauncher; | ||
import java.io.IOException; | ||
|
||
public class CassandraDatabaseLauncher implements DatabaseLauncher { | ||
|
||
/** | ||
* Function to launch an Cassandra database. | ||
*/ | ||
@Override | ||
public void launchDatabase(String systemPassword) throws IOException, InterruptedException { | ||
String commands = "echo " + systemPassword + " | sudo -S " | ||
+ "update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java" | ||
+ " && echo " + systemPassword + " | sudo -S systemctl start cassandra.service" | ||
+ " && sudo systemctl status cassandra"; | ||
executeCommand(commands); | ||
} | ||
|
||
/** | ||
* Function to shutdown an Cassandra database. | ||
*/ | ||
@Override | ||
public void shutdownDatabase(String systemPassword) throws IOException, InterruptedException { | ||
String commands = "echo " + systemPassword + " | sudo -S systemctl stop cassandra.service" | ||
+ " && sudo systemctl status cassandra"; | ||
executeCommand(commands); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...on/opendistroforelasticsearch/sql/benchmark/utils/load/cassandra/CassandraDataFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.cassandra; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.DataFormat; | ||
|
||
/** | ||
* Data format for Cassandra database. | ||
*/ | ||
public class CassandraDataFormat extends DataFormat { | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...on/opendistroforelasticsearch/sql/benchmark/utils/load/cassandra/CassandraDataLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.cassandra; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.DataFormat; | ||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.DataLoader; | ||
|
||
/** | ||
* Data loader for Cassandra database. | ||
*/ | ||
public class CassandraDataLoader implements DataLoader { | ||
|
||
/** | ||
* Load function for Cassandra databases. | ||
* | ||
* @param data Data to load in CassandraDataFormat. | ||
* @throws Exception Throws an Exception if data does not match expected type. | ||
*/ | ||
@Override | ||
public void loadData(DataFormat data) throws Exception { | ||
if (!(data instanceof CassandraDataFormat)) { | ||
throw new IllegalArgumentException("Wrong data format for Cassandra."); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...endistroforelasticsearch/sql/benchmark/utils/load/cassandra/CassandraDataTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.cassandra; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.DataFormat; | ||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.load.DataTransformer; | ||
|
||
/** | ||
* Data transformer for Cassandra database. | ||
*/ | ||
public class CassandraDataTransformer implements DataTransformer { | ||
|
||
/** | ||
* Data transforming function for Cassandra. | ||
* | ||
* @param dataPath Directory for data to transform. | ||
* @return Path to transformed data. | ||
* @throws Exception Throws and exception if file read fails. | ||
*/ | ||
@Override | ||
public DataFormat transformData(String dataPath) throws Exception { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
.../opendistroforelasticsearch/sql/benchmark/utils/query/cassandra/CassandraQueryRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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 com.amazon.opendistroforelasticsearch.sql.benchmark.utils.query.cassandra; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.benchmark.utils.query.QueryRunner; | ||
|
||
/** | ||
* Query runner for Cassandra databases. | ||
*/ | ||
public class CassandraQueryRunner extends QueryRunner { | ||
|
||
/** | ||
* Function to run queries against Cassandra database. | ||
*/ | ||
@Override | ||
public void runQuery() throws Exception { | ||
|
||
} | ||
|
||
/** | ||
* Function to prepare query runner against Cassandra database. | ||
* | ||
* @param query Query to run against Cassandra database. | ||
*/ | ||
@Override | ||
public void prepareQueryRunner(String query) throws Exception { | ||
|
||
} | ||
|
||
/** | ||
* Function to check query execution status against Cassandra database. | ||
*/ | ||
@Override | ||
public void checkQueryExecutionStatus(String benchmarkPath) throws Exception { | ||
|
||
} | ||
} |