Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
DRILL-6494: Drill Plugins Handler
- Storage Plugins Handler service is used op the Drill start-up stage and it updates storage plugins configs from storage-plugins-override.conf file. If plugins configs are present in the persistence store - they are updated, otherwise bootstrap plugins are updated and the result configs are loaded to persistence store. If the enabled status is absent in the storage-plugins-override.conf file, the last plugin config enabled status persists. - 'drill.exec.storage.action_on_plugins_override_file' Boot option is added. This is the action, which should be performed on the storage-plugins-override.conf file after successful updating storage plugins configs. Possible values are: "none" (default), "rename" and "remove". - The "NULL" issue with updating Hive plugin config by REST is solved. But clients are still being instantiated for disabled plugins - DRILL-6412. - "org.honton.chas.hocon:jackson-dataformat-hocon" library is added for the proper deserializing HOCON conf file - additional refactoring: "com.typesafe:config" and "org.apache.commons:commons-lang3" are placed into DependencyManagement block with proper versions; correct properties for metrics in "drill-override-example.conf" are specified closes #1345
- Loading branch information
Showing
35 changed files
with
680 additions
and
201 deletions.
There are no files selected for viewing
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
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
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
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
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,87 @@ | ||
/* | ||
* 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.drill.exec.util; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
/** | ||
* It defines possible actions on the file and performs the necessary action | ||
*/ | ||
public enum ActionOnFile { | ||
|
||
/** | ||
* No action will be performed | ||
*/ | ||
NONE { | ||
@Override | ||
public void action(URL url) { } | ||
}, | ||
|
||
/** | ||
* Rename the file by adding current timestamp value with "yyyyMMdd_HHmmss" format before last dot of original file name<p> | ||
* Example:<br> | ||
* Original file name: "storage-plugins-override.conf"<br> | ||
* New file name: "storage-plugins-override-20180703_033354.conf" | ||
*/ | ||
RENAME { | ||
@Override | ||
public void action(URL url) { | ||
String fileName = url.getFile(); | ||
File file = new File(url.getPath()); | ||
String currentDateTime = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); | ||
String newFileName = new StringBuilder(fileName) | ||
.insert(fileName.lastIndexOf("."), "-" + currentDateTime) | ||
.toString(); | ||
Path filePath = file.toPath(); | ||
try { | ||
Files.move(filePath, filePath.resolveSibling(newFileName)); | ||
} catch (IOException e) { | ||
logger.error("There was an error during file {} rename.", fileName, e); | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* It removes the file | ||
*/ | ||
REMOVE { | ||
@Override | ||
public void action(URL url) { | ||
File file = new File(url.getPath()); | ||
try { | ||
Files.delete(file.toPath()); | ||
} catch (IOException e) { | ||
logger.error("There was an error during file {} removing.", url.getFile(), e); | ||
} | ||
} | ||
}; | ||
|
||
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ActionOnFile.class); | ||
|
||
/** | ||
* This is an action which should be performed on the file | ||
* @param url the file URL | ||
*/ | ||
public abstract void action(URL url); | ||
} |
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
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
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
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
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
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
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
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
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,65 @@ | ||
# 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. | ||
|
||
# This file involves storage plugins configs, which can be updated on the Drill start-up. | ||
# This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information. | ||
|
||
"storage":{ | ||
cp: { | ||
type: "file", | ||
connection: "classpath:///", | ||
formats: { | ||
"csv" : { | ||
type: "text", | ||
extensions: [ "csv" ], | ||
delimiter: "," | ||
} | ||
} | ||
} | ||
} | ||
"storage":{ | ||
dfs: { | ||
type: "file", | ||
connection: "hdfs:///", | ||
workspaces: { | ||
"root": { | ||
"location": "/", | ||
"writable": false, | ||
"defaultInputFormat": null, | ||
"allowAccessOutsideWorkspace": false | ||
} | ||
}, | ||
formats: { | ||
"parquet": { | ||
"type": "parquet" | ||
} | ||
}, | ||
enabled: false | ||
} | ||
} | ||
"storage":{ | ||
mongo : { | ||
type:"mongo", | ||
connection:"mongodb://test_host:27017/", | ||
enabled: true | ||
} | ||
} | ||
"storage": { | ||
openTSDB: { | ||
type: "openTSDB", | ||
connection: "http://localhost:8888", | ||
enabled: true | ||
} | ||
} |
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
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
Oops, something went wrong.