Skip to content

Commit

Permalink
[FSTORE-1338] Online Feature Group fails to be deleted if the online …
Browse files Browse the repository at this point in the history
…table was dropped (#1793)
  • Loading branch information
bubriks committed May 21, 2024
1 parent d34dfd7 commit f665409
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions hopsworks-IT/src/test/ruby/spec/featuregroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2752,6 +2752,22 @@
expect_status_details(200)
end

it "should be able to delete a cached online featuregroup from the featurestore even if online table was deleted" do
project = get_project
featurestore_id = get_featurestore_id(project.id)
json_result, featuregroup_name = create_cached_featuregroup(project.id, featurestore_id, online:true)
parsed_json = JSON.parse(json_result)
expect_status_details(201)

# delete onlinefs table
ActiveRecord::Base.connection.execute "DROP TABLE " + project.projectname + "." + parsed_json["name"] + "_" + parsed_json["version"].to_s

featuregroup_id = parsed_json["id"]
delete_featuregroup_endpoint = "#{ENV['HOPSWORKS_API']}/project/" + project.id.to_s + "/featurestores/" + featurestore_id.to_s + "/featuregroups/" + featuregroup_id.to_s
delete delete_featuregroup_endpoint
expect_status_details(200)
end

it "should be able to update the metadata of a cached online featuregroup from the featurestore" do
project = get_project
featurestore_id = get_featurestore_id(project.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected OnlineFeaturegroupController(Settings settings, EmbeddingController em
*/
public void dropMySQLTable(Featuregroup featuregroup, Project project, Users user) throws FeaturestoreException {
//Drop data table
String query = "DROP TABLE " + featuregroup.getName() + "_" + featuregroup.getVersion() + ";";
String query = "DROP TABLE IF EXISTS " + featuregroup.getName() + "_" + featuregroup.getVersion() + ";";
onlineFeaturestoreFacade.executeUpdateJDBCQuery(query,
onlineFeaturestoreController.getOnlineFeaturestoreDbName(featuregroup.getFeaturestore().getProject()),
project, user);
Expand Down

0 comments on commit f665409

Please sign in to comment.