Skip to content

Commit f02d296

Browse files
authored
Merge pull request #317 from caskdata/feature/COOK-55-derby-db-dir
COOK-55 Create Derby DB directories
2 parents 4e4a640 + fc58fae commit f02d296

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

recipes/hive_metastore.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Cookbook Name:: hadoop
33
# Recipe:: hive_metastore
44
#
5-
# Copyright © 2013-2015 Cask Data, Inc.
5+
# Copyright © 2013-2017 Cask Data, Inc.
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
88
# you may not use this file except in compliance with the License.
@@ -40,6 +40,18 @@
4040
end
4141
end
4242

43+
derby_db =
44+
if hive_sql == 'derby' && node['hive'].key?('hive_site') && node['hive']['hive_site'].key?('javax.jdo.option.ConnectionURL')
45+
node['hive']['hive_site']['javax.jdo.option.ConnectionURL'].split(':')[2].split(';').find { |o| /^databaseName/ =~ o }.split('=')[1]
46+
else
47+
# We set this to our default, because the Hive default uses the current working directory
48+
'/var/lib/hive/metastore/metastore_db'
49+
end
50+
51+
directory ::File.dirname(derby_db) do
52+
action :create
53+
end
54+
4355
# Hive HDFS directories
4456
dfs = node['hadoop']['core_site']['fs.defaultFS']
4557
warehouse_dir =

recipes/oozie.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Cookbook Name:: hadoop
33
# Recipe:: oozie
44
#
5-
# Copyright © 2013-2016 Cask Data, Inc.
5+
# Copyright © 2013-2017 Cask Data, Inc.
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
88
# you may not use this file except in compliance with the License.
@@ -35,6 +35,19 @@
3535
'derby'
3636
end
3737

38+
derby_db =
39+
if oozie_sql == 'derby' && node['oozie'].key?('oozie_site') && node['oozie']['oozie_site'].key?('oozie.service.JPAService.jdbc.url')
40+
node['oozie']['oozie_site']['oozie.service.JPAService.jdbc.url'].split(':')[2].split(';').find { |o| /^databaseName/ =~ o }.split('=')
41+
elsif node['oozie'].key?('oozie_site') && node['oozie']['oozie_site'].key?('oozie.db.schema.name')
42+
"#{oozie_data_dir}/#{node['oozie']['oozie_site']['oozie.db.schema.name']}-db"
43+
else
44+
"#{oozie_data_dir}/oozie-db"
45+
end
46+
47+
directory ::File.dirname(derby_db) do
48+
action :create
49+
end
50+
3851
node.default['hadoop']['sql_connector'] = oozie_sql
3952
include_recipe 'hadoop::_sql_connectors'
4053

0 commit comments

Comments
 (0)