Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ if [ $CP_ETC -eq 1 ]; then
fi

# find and copy pixels.properties
PIXELS_PROPERTIES_CREATED=0
if [ ! -f "$PIXELS_HOME/etc/pixels.properties" ]; then
cp -v ./pixels-common/src/main/resources/pixels.properties $PIXELS_HOME/etc
PIXELS_PROPERTIES_CREATED=1
echo "$(
tput setaf 1
tput setab 7
Expand Down Expand Up @@ -151,6 +153,12 @@ else
rm -f $TEMPLATE_KEYS $TARGET_KEYS $NEW_KEYS $DEPRECATED_KEYS $NEW_OPTIONS $DEPRECATED_OPTIONS
fi

# Make a fresh Derby installation independent of the source checkout path.
if [ $PIXELS_PROPERTIES_CREATED -eq 1 ]; then
sed -i "s#^pixels.var.dir=.*#pixels.var.dir=$PIXELS_HOME/var/#" $PIXELS_HOME/etc/pixels.properties
sed -i "s#^metadata.db.url=jdbc:derby:.*#metadata.db.url=jdbc:derby:$PIXELS_HOME/var/pixels_metadata;create=true#" $PIXELS_HOME/etc/pixels.properties
fi

# find and copy pixels-cpp.properties
if [ -z "$(find $PIXELS_HOME/etc -name "pixels-cpp.properties")" ]; then
cp -v ./cpp/etc/pixels-cpp.properties $PIXELS_HOME/etc
Expand Down
1 change: 1 addition & 0 deletions pixels-common/src/main/resources/pixels.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata.db.user=pixels
metadata.db.password=password
#metadata.db.url=jdbc:mysql://localhost:3306/pixels_metadata?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
metadata.db.url=jdbc:derby:/home/pixels/opt/pixels/var/pixels_metadata;create=true
metadata.db.driver=org.apache.derby.jdbc.EmbeddedDriver
# metadata server host and port
metadata.server.port=18888
metadata.server.host=localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ public boolean update(MetadataProto.Column column)
Connection conn = db.getConnection();
String sql = "UPDATE COLS\n" +
"SET\n" +
"`COL_NAME` = ?," +
"`COL_TYPE` = ?," +
"`COL_CHUNK_SIZE` = ?," +
"`COL_SIZE` = ?," +
"`COL_NULL_FRACTION` = ?," +
"`COL_CARDINALITY` = ?," +
"`COL_RECORD_STATS` = ?\n" +
"WHERE `COL_ID` = ?";
"COL_NAME = ?," +
"COL_TYPE = ?," +
"COL_CHUNK_SIZE = ?," +
"COL_SIZE = ?," +
"COL_NULL_FRACTION = ?," +
"COL_CARDINALITY = ?," +
"COL_RECORD_STATS = ?\n" +
"WHERE COL_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, column.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ public long insert(MetadataProto.File file)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO FILES(" +
"`FILE_NAME`," +
"`FILE_TYPE`," +
"`FILE_NUM_RG`," +
"`FILE_MIN_ROW_ID`," +
"`FILE_MAX_ROW_ID`," +
"`PATHS_PATH_ID`," +
"`FILE_CLEANUP_AT`) VALUES (?,?,?,?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
"FILE_NAME," +
"FILE_TYPE," +
"FILE_NUM_RG," +
"FILE_MIN_ROW_ID," +
"FILE_MAX_ROW_ID," +
"PATHS_PATH_ID," +
"FILE_CLEANUP_AT) VALUES (?,?,?,?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS))
{
pst.setString(1, file.getName());
pst.setInt(2, file.getTypeValue());
Expand All @@ -238,7 +238,7 @@ public long insert(MetadataProto.File file)
setCleanupAt(pst, 7, file);
if (pst.executeUpdate() == 1)
{
try (ResultSet rs = pst.executeQuery("SELECT LAST_INSERT_ID()"))
try (ResultSet rs = pst.getGeneratedKeys())
{
if (rs.next())
{
Expand Down Expand Up @@ -267,13 +267,13 @@ public boolean insertBatch(List<MetadataProto.File> files)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO FILES(" +
"`FILE_NAME`," +
"`FILE_TYPE`," +
"`FILE_NUM_RG`," +
"`FILE_MIN_ROW_ID`," +
"`FILE_MAX_ROW_ID`," +
"`PATHS_PATH_ID`," +
"`FILE_CLEANUP_AT`) VALUES (?,?,?,?,?,?,?)";
"FILE_NAME," +
"FILE_TYPE," +
"FILE_NUM_RG," +
"FILE_MIN_ROW_ID," +
"FILE_MAX_ROW_ID," +
"PATHS_PATH_ID," +
"FILE_CLEANUP_AT) VALUES (?,?,?,?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
for (MetadataProto.File file : files)
Expand Down Expand Up @@ -301,13 +301,13 @@ public boolean update(MetadataProto.File file)
{
Connection conn = db.getConnection();
String sql = "UPDATE FILES SET\n" +
"`FILE_NAME` = ?," +
"`FILE_TYPE` = ?," +
"`FILE_NUM_RG` = ?," +
"`FILE_MIN_ROW_ID` = ?," +
"`FILE_MAX_ROW_ID` = ?," +
"`FILE_CLEANUP_AT` = ?\n" +
"WHERE `FILE_ID` = ?";
"FILE_NAME = ?," +
"FILE_TYPE = ?," +
"FILE_NUM_RG = ?," +
"FILE_MIN_ROW_ID = ?," +
"FILE_MAX_ROW_ID = ?," +
"FILE_CLEANUP_AT = ?\n" +
"WHERE FILE_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, file.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ public long insert (MetadataProto.Layout layout)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO LAYOUTS(" +
"`LAYOUT_VERSION`," +
"`LAYOUT_CREATE_AT`," +
"`LAYOUT_PERMISSION`," +
"`LAYOUT_ORDERED`," +
"`LAYOUT_COMPACT`," +
"`LAYOUT_SPLITS`," +
"`LAYOUT_PROJECTIONS`," +
"`SCHEMA_VERSIONS_SV_ID`," +
"`TBLS_TBL_ID`) VALUES (?,?,?,?,?,?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
"LAYOUT_VERSION," +
"LAYOUT_CREATE_AT," +
"LAYOUT_PERMISSION," +
"LAYOUT_ORDERED," +
"LAYOUT_COMPACT," +
"LAYOUT_SPLITS," +
"LAYOUT_PROJECTIONS," +
"SCHEMA_VERSIONS_SV_ID," +
"TBLS_TBL_ID) VALUES (?,?,?,?,?,?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS))
{
pst.setLong(1, layout.getVersion());
pst.setLong(2, layout.getCreateAt());
Expand All @@ -239,7 +239,7 @@ public long insert (MetadataProto.Layout layout)
pst.setLong(9, layout.getTableId());
if (pst.executeUpdate() == 1)
{
ResultSet rs = pst.executeQuery("SELECT LAST_INSERT_ID()");
ResultSet rs = pst.getGeneratedKeys();
if (rs.next())
{
return rs.getLong(1);
Expand All @@ -266,14 +266,14 @@ public boolean update (MetadataProto.Layout layout)
Connection conn = db.getConnection();
String sql = "UPDATE LAYOUTS\n" +
"SET\n" +
"`LAYOUT_VERSION` = ?," +
"`LAYOUT_CREATE_AT` = ?," +
"`LAYOUT_PERMISSION` = ?," +
"`LAYOUT_ORDERED` = ?," +
"`LAYOUT_COMPACT` = ?," +
"`LAYOUT_SPLITS` = ?," +
"`LAYOUT_PROJECTIONS` = ?\n" +
"WHERE `LAYOUT_ID` = ?";
"LAYOUT_VERSION = ?," +
"LAYOUT_CREATE_AT = ?," +
"LAYOUT_PERMISSION = ?," +
"LAYOUT_ORDERED = ?," +
"LAYOUT_COMPACT = ?," +
"LAYOUT_SPLITS = ?," +
"LAYOUT_PROJECTIONS = ?\n" +
"WHERE LAYOUT_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setLong(1, layout.getVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ public long insert(MetadataProto.Path path)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO PATHS(" +
"`PATH_URI`," +
"`PATH_TYPE`," +
"`LAYOUTS_LAYOUT_ID`," +
"`RANGES_RANGE_ID`) VALUES (?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
"PATH_URI," +
"PATH_TYPE," +
"LAYOUTS_LAYOUT_ID," +
"RANGES_RANGE_ID) VALUES (?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS))
{
pst.setString(1, path.getUri());
pst.setInt(2, path.getTypeValue());
Expand All @@ -193,7 +193,7 @@ public long insert(MetadataProto.Path path)
}
if (pst.executeUpdate() == 1)
{
ResultSet rs = pst.executeQuery("SELECT LAST_INSERT_ID()");
ResultSet rs = pst.getGeneratedKeys();
if (rs.next())
{
return rs.getLong(1);
Expand Down Expand Up @@ -221,9 +221,9 @@ public boolean update(MetadataProto.Path path)
Connection conn = db.getConnection();
String sql = "UPDATE PATHS\n" +
"SET\n" +
"`PATH_URI` = ?," +
"`PATH_IS_COMPACT` = ?\n" +
"WHERE `PATH_ID` = ?";
"PATH_URI = ?," +
"PATH_IS_COMPACT = ?\n" +
"WHERE PATH_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, path.getUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ public boolean insert(MetadataProto.Peer peer)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO PEERS(" +
"`PEER_NAME`," +
"`PEER_LOCATION`," +
"`PEER_HOST`," +
"`PEER_PORT`," +
"`PEER_STORAGE_SCHEME`) VALUES (?,?,?,?,?)";
"PEER_NAME," +
"PEER_LOCATION," +
"PEER_HOST," +
"PEER_PORT," +
"PEER_STORAGE_SCHEME) VALUES (?,?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, peer.getName());
Expand All @@ -178,11 +178,11 @@ public boolean update(MetadataProto.Peer peer)
Connection conn = db.getConnection();
String sql = "UPDATE PEERS\n" +
"SET\n" +
"`PEER_LOCATION` = ?," +
"`PEER_HOST` = ?," +
"`PEER_PORT` = ?," +
"`PEER_STORAGE_SCHEME` = ?\n" +
"WHERE `PEER_ID` = ? OR `PEER_NAME` = ?";
"PEER_LOCATION = ?," +
"PEER_HOST = ?," +
"PEER_PORT = ?," +
"PEER_STORAGE_SCHEME = ?\n" +
"WHERE PEER_ID = ? OR PEER_NAME = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, peer.getLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ public long insert(MetadataProto.PeerPath peerPath)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO PEER_PATHS(" +
"`PEER_PATH_URI`," +
"`PEER_PATH_COLUMNS`," +
"`PATHS_PATH_ID`," +
"`PEERS_PEER_ID`) VALUES (?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
"PEER_PATH_URI," +
"PEER_PATH_COLUMNS," +
"PATHS_PATH_ID," +
"PEERS_PEER_ID) VALUES (?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS))
{
pst.setString(1, peerPath.getUri());
pst.setString(2, JSON.toJSONString(new Columns(peerPath.getColumnsList())));
pst.setLong(3, peerPath.getPathId());
pst.setLong(4, peerPath.getPeerId());
if (pst.executeUpdate() == 1)
{
ResultSet rs = pst.executeQuery("SELECT LAST_INSERT_ID()");
ResultSet rs = pst.getGeneratedKeys();
if (rs.next())
{
return rs.getLong(1);
Expand Down Expand Up @@ -193,9 +193,9 @@ public boolean update(MetadataProto.PeerPath peerPath)
Connection conn = db.getConnection();
String sql = "UPDATE PEER_PATHS\n" +
"SET\n" +
"`PEER_PATH_URI` = ?," +
"`PEER_PATH_COLUMNS` = ?\n" +
"WHERE `PEER_PATH_ID` = ?";
"PEER_PATH_URI = ?," +
"PEER_PATH_COLUMNS = ?\n" +
"WHERE PEER_PATH_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, peerPath.getUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public long insert(MetadataProto.Range range)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO RANGES(" +
"`RANGE_MIN`," +
"`RANGE_MAX`," +
"`RANGE_PARENT_ID`," +
"`RANGE_INDEXES_RI_ID`) VALUES (?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
"RANGE_MIN," +
"RANGE_MAX," +
"RANGE_PARENT_ID," +
"RANGE_INDEXES_RI_ID) VALUES (?,?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS))
{
pst.setBytes(1, range.getMin().toByteArray());
pst.setBytes(2, range.getMax().toByteArray());
Expand All @@ -140,7 +140,7 @@ public long insert(MetadataProto.Range range)
pst.setLong(4, range.getRangeIndexId());
if (pst.executeUpdate() == 1)
{
ResultSet rs = pst.executeQuery("SELECT LAST_INSERT_ID()");
ResultSet rs = pst.getGeneratedKeys();
if (rs.next())
{
return rs.getLong(1);
Expand Down Expand Up @@ -168,11 +168,11 @@ public boolean update(MetadataProto.Range range)
Connection conn = db.getConnection();
String sql = "UPDATE RANGES\n" +
"SET\n" +
"`RANGE_MIN` = ?," +
"`RANGE_MXN` = ?," +
"`RANGE_PARENT_ID` = ?," +
"`RANGE_INDEXES_RI_ID` = ?\n" +
"WHERE `RANGE_ID` = ?";
"RANGE_MIN = ?," +
"RANGE_MXN = ?," +
"RANGE_PARENT_ID = ?," +
"RANGE_INDEXES_RI_ID = ?\n" +
"WHERE RANGE_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setBytes(1, range.getMin().toByteArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ public long insert(MetadataProto.RangeIndex rangeIndex)
{
Connection conn = db.getConnection();
String sql = "INSERT INTO RANGE_INDEXES(" +
"`RI_KEY_COLUMNS`," +
"`TBLS_TBL_ID`," +
"`SCHEMA_VERSIONS_SV_ID`) VALUES (?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql))
"RI_KEY_COLUMNS," +
"TBLS_TBL_ID," +
"SCHEMA_VERSIONS_SV_ID) VALUES (?,?,?)";
try (PreparedStatement pst = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS))
{
pst.setString(1, rangeIndex.getKeyColumns());
pst.setLong(2, rangeIndex.getTableId());
pst.setLong(3, rangeIndex.getSchemaVersionId());
if (pst.executeUpdate() == 1)
{
ResultSet rs = pst.executeQuery("SELECT LAST_INSERT_ID()");
ResultSet rs = pst.getGeneratedKeys();
if (rs.next())
{
return rs.getLong(1);
Expand Down Expand Up @@ -180,10 +180,10 @@ public boolean update(MetadataProto.RangeIndex rangeIndex)
Connection conn = db.getConnection();
String sql = "UPDATE RANGE_INDEXES\n" +
"SET\n" +
"`RI_KEY_COLUMNS` = ?," +
"`TBLS_TBL_ID` = ?," +
"`SCHEMA_VERSIONS_SV_ID` = ?\n" +
"WHERE `RI_ID` = ?";
"RI_KEY_COLUMNS = ?," +
"TBLS_TBL_ID = ?," +
"SCHEMA_VERSIONS_SV_ID = ?\n" +
"WHERE RI_ID = ?";
try (PreparedStatement pst = conn.prepareStatement(sql))
{
pst.setString(1, rangeIndex.getKeyColumns());
Expand Down
Loading
Loading