mirror of https://github.com/apache/druid.git
Added support for task storage in PostgreSQL
This commit is contained in:
parent
4b67dbff5f
commit
a835db2a3c
|
@ -45,7 +45,7 @@ public class DbConnector
|
||||||
segmentTableName,
|
segmentTableName,
|
||||||
String.format(
|
String.format(
|
||||||
isPostgreSQL(dbi) ?
|
isPostgreSQL(dbi) ?
|
||||||
"CREATE TABLE %1$s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, created_date TEXT NOT NULL, start TEXT NOT NULL, \"end\" TEXT NOT NULL, partitioned SMALLINT NOT NULL, version TEXT NOT NULL, used BOOLEAN NOT NULL, payload TEXT NOT NULL, PRIMARY KEY (id));" +
|
"CREATE TABLE %1$s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, created_date TEXT NOT NULL, start TEXT NOT NULL, \"end\" TEXT NOT NULL, partitioned SMALLINT NOT NULL, version TEXT NOT NULL, used BOOLEAN NOT NULL, payload bytea NOT NULL, PRIMARY KEY (id));" +
|
||||||
"CREATE INDEX ON %1$s(dataSource);"+
|
"CREATE INDEX ON %1$s(dataSource);"+
|
||||||
"CREATE INDEX ON %1$s(used);":
|
"CREATE INDEX ON %1$s(used);":
|
||||||
"CREATE table %s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, created_date TINYTEXT NOT NULL, start TINYTEXT NOT NULL, end TINYTEXT NOT NULL, partitioned BOOLEAN NOT NULL, version TINYTEXT NOT NULL, used BOOLEAN NOT NULL, payload LONGTEXT NOT NULL, INDEX(dataSource), INDEX(used), PRIMARY KEY (id))",
|
"CREATE table %s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, created_date TINYTEXT NOT NULL, start TINYTEXT NOT NULL, end TINYTEXT NOT NULL, partitioned BOOLEAN NOT NULL, version TINYTEXT NOT NULL, used BOOLEAN NOT NULL, payload LONGTEXT NOT NULL, INDEX(dataSource), INDEX(used), PRIMARY KEY (id))",
|
||||||
|
@ -61,7 +61,7 @@ public class DbConnector
|
||||||
ruleTableName,
|
ruleTableName,
|
||||||
String.format(
|
String.format(
|
||||||
isPostgreSQL(dbi) ?
|
isPostgreSQL(dbi) ?
|
||||||
"CREATE TABLE %1$s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, version TEXT NOT NULL, payload TEXT NOT NULL, PRIMARY KEY (id));"+
|
"CREATE TABLE %1$s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, version TEXT NOT NULL, payload bytea NOT NULL, PRIMARY KEY (id));"+
|
||||||
"CREATE INDEX ON %1$s(dataSource);":
|
"CREATE INDEX ON %1$s(dataSource);":
|
||||||
"CREATE table %s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, version TINYTEXT NOT NULL, payload LONGTEXT NOT NULL, INDEX(dataSource), PRIMARY KEY (id))",
|
"CREATE table %s (id VARCHAR(255) NOT NULL, dataSource VARCHAR(255) NOT NULL, version TINYTEXT NOT NULL, payload LONGTEXT NOT NULL, INDEX(dataSource), PRIMARY KEY (id))",
|
||||||
ruleTableName
|
ruleTableName
|
||||||
|
@ -89,16 +89,27 @@ public class DbConnector
|
||||||
dbi,
|
dbi,
|
||||||
taskTableName,
|
taskTableName,
|
||||||
String.format(
|
String.format(
|
||||||
"CREATE TABLE `%s` (\n"
|
isPostgreSQL(dbi) ?
|
||||||
+ " `id` varchar(255) NOT NULL,\n"
|
"CREATE TABLE %1$s (\n"
|
||||||
+ " `created_date` tinytext NOT NULL,\n"
|
+ " id varchar(255) NOT NULL,\n"
|
||||||
+ " `datasource` varchar(255) NOT NULL,\n"
|
+ " created_date TEXT NOT NULL,\n"
|
||||||
+ " `payload` longblob NOT NULL,\n"
|
+ " datasource varchar(255) NOT NULL,\n"
|
||||||
+ " `status_payload` longblob NOT NULL,\n"
|
+ " payload bytea NOT NULL,\n"
|
||||||
+ " `active` tinyint(1) NOT NULL DEFAULT '0',\n"
|
+ " status_payload bytea NOT NULL,\n"
|
||||||
+ " PRIMARY KEY (`id`),\n"
|
+ " active SMALLINT NOT NULL DEFAULT '0',\n"
|
||||||
+ " KEY (active, created_date(100))\n"
|
+ " PRIMARY KEY (id)\n"
|
||||||
+ ")",
|
+ ");\n" +
|
||||||
|
"CREATE INDEX ON %1$s(active, created_date);":
|
||||||
|
"CREATE TABLE `%s` (\n"
|
||||||
|
+ " `id` varchar(255) NOT NULL,\n"
|
||||||
|
+ " `created_date` tinytext NOT NULL,\n"
|
||||||
|
+ " `datasource` varchar(255) NOT NULL,\n"
|
||||||
|
+ " `payload` longblob NOT NULL,\n"
|
||||||
|
+ " `status_payload` longblob NOT NULL,\n"
|
||||||
|
+ " `active` tinyint(1) NOT NULL DEFAULT '0',\n"
|
||||||
|
+ " PRIMARY KEY (`id`),\n"
|
||||||
|
+ " KEY (active, created_date(100))\n"
|
||||||
|
+ ")",
|
||||||
taskTableName
|
taskTableName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -110,13 +121,21 @@ public class DbConnector
|
||||||
dbi,
|
dbi,
|
||||||
taskLogsTableName,
|
taskLogsTableName,
|
||||||
String.format(
|
String.format(
|
||||||
"CREATE TABLE `%s` (\n"
|
isPostgreSQL(dbi) ?
|
||||||
+ " `id` bigint(20) NOT NULL AUTO_INCREMENT,\n"
|
"CREATE TABLE %1$s (\n"
|
||||||
+ " `task_id` varchar(255) DEFAULT NULL,\n"
|
+ " id bigserial NOT NULL,\n"
|
||||||
+ " `log_payload` longblob,\n"
|
+ " task_id varchar(255) DEFAULT NULL,\n"
|
||||||
+ " PRIMARY KEY (`id`),\n"
|
+ " log_payload bytea,\n"
|
||||||
+ " KEY `task_id` (`task_id`)\n"
|
+ " PRIMARY KEY (id)\n"
|
||||||
+ ")",
|
+ ");\n"+
|
||||||
|
"CREATE INDEX ON %1$s(task_id);":
|
||||||
|
"CREATE TABLE `%s` (\n"
|
||||||
|
+ " `id` bigint(20) NOT NULL AUTO_INCREMENT,\n"
|
||||||
|
+ " `task_id` varchar(255) DEFAULT NULL,\n"
|
||||||
|
+ " `log_payload` longblob,\n"
|
||||||
|
+ " PRIMARY KEY (`id`),\n"
|
||||||
|
+ " KEY `task_id` (`task_id`)\n"
|
||||||
|
+ ")",
|
||||||
taskLogsTableName
|
taskLogsTableName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -128,13 +147,21 @@ public class DbConnector
|
||||||
dbi,
|
dbi,
|
||||||
taskLocksTableName,
|
taskLocksTableName,
|
||||||
String.format(
|
String.format(
|
||||||
"CREATE TABLE `%s` (\n"
|
isPostgreSQL(dbi) ?
|
||||||
+ " `id` bigint(20) NOT NULL AUTO_INCREMENT,\n"
|
"CREATE TABLE %1$s (\n"
|
||||||
+ " `task_id` varchar(255) DEFAULT NULL,\n"
|
+ " id bigserial NOT NULL,\n"
|
||||||
+ " `lock_payload` longblob,\n"
|
+ " task_id varchar(255) DEFAULT NULL,\n"
|
||||||
+ " PRIMARY KEY (`id`),\n"
|
+ " lock_payload bytea,\n"
|
||||||
+ " KEY `task_id` (`task_id`)\n"
|
+ " PRIMARY KEY (id)\n"
|
||||||
+ ")",
|
+ ");\n"+
|
||||||
|
"CREATE INDEX ON %1$s(task_id);":
|
||||||
|
"CREATE TABLE `%s` (\n"
|
||||||
|
+ " `id` bigint(20) NOT NULL AUTO_INCREMENT,\n"
|
||||||
|
+ " `task_id` varchar(255) DEFAULT NULL,\n"
|
||||||
|
+ " `lock_payload` longblob,\n"
|
||||||
|
+ " PRIMARY KEY (`id`),\n"
|
||||||
|
+ " KEY `task_id` (`task_id`)\n"
|
||||||
|
+ ")",
|
||||||
taskLocksTableName
|
taskLocksTableName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue