|
| 1 | +CREATE TABLE IF NOT EXISTS metadata( |
| 2 | + key_id bigserial PRIMARY KEY, |
| 3 | + identifier varchar(36) NOT NULL, |
| 4 | + session_type varchar(32) NOT NULL, |
| 5 | + real_user varchar(255) NOT NULL, |
| 6 | + user_name varchar(255) NOT NULL, |
| 7 | + ip_address varchar(128), |
| 8 | + kyuubi_instance varchar(1024), |
| 9 | + state varchar(128) NOT NULL, |
| 10 | + resource varchar(1024), |
| 11 | + class_name varchar(1024), |
| 12 | + request_name varchar(1024), |
| 13 | + request_conf text, |
| 14 | + request_args text, |
| 15 | + create_time bigint NOT NULL, |
| 16 | + engine_type varchar(32) NOT NULL, |
| 17 | + cluster_manager varchar(128), |
| 18 | + engine_open_time bigint, |
| 19 | + engine_id varchar(128), |
| 20 | + engine_name text, |
| 21 | + engine_url varchar(1024), |
| 22 | + engine_state varchar(32), |
| 23 | + engine_error text, |
| 24 | + end_time bigint, |
| 25 | + priority int NOT NULL DEFAULT 10, |
| 26 | + peer_instance_closed boolean DEFAULT FALSE |
| 27 | +); |
| 28 | + |
| 29 | +COMMENT ON COLUMN metadata.key_id IS 'the auto increment key id'; |
| 30 | +COMMENT ON COLUMN metadata.identifier IS 'the identifier id, which is an UUID'; |
| 31 | +COMMENT ON COLUMN metadata.session_type IS 'the session type, SQL or BATCH'; |
| 32 | +COMMENT ON COLUMN metadata.real_user IS 'the real user'; |
| 33 | +COMMENT ON COLUMN metadata.user_name IS 'the user name, might be a proxy user'; |
| 34 | +COMMENT ON COLUMN metadata.ip_address IS 'the client ip address'; |
| 35 | +COMMENT ON COLUMN metadata.kyuubi_instance IS 'the kyuubi instance that creates this'; |
| 36 | +COMMENT ON COLUMN metadata.state IS 'the session state'; |
| 37 | +COMMENT ON COLUMN metadata.resource IS 'the main resource'; |
| 38 | +COMMENT ON COLUMN metadata.class_name IS 'the main class name'; |
| 39 | +COMMENT ON COLUMN metadata.request_name IS 'the request name'; |
| 40 | +COMMENT ON COLUMN metadata.request_conf IS 'the request config map'; |
| 41 | +COMMENT ON COLUMN metadata.request_args IS 'the request arguments'; |
| 42 | +COMMENT ON COLUMN metadata.create_time IS 'the metadata create time'; |
| 43 | +COMMENT ON COLUMN metadata.engine_type IS 'the engine type'; |
| 44 | +COMMENT ON COLUMN metadata.cluster_manager IS 'the engine cluster manager'; |
| 45 | +COMMENT ON COLUMN metadata.engine_open_time IS 'the engine open time'; |
| 46 | +COMMENT ON COLUMN metadata.engine_id IS 'the engine application id'; |
| 47 | +COMMENT ON COLUMN metadata.engine_name IS 'the engine application name'; |
| 48 | +COMMENT ON COLUMN metadata.engine_url IS 'the engine tracking url'; |
| 49 | +COMMENT ON COLUMN metadata.engine_state IS 'the engine application state'; |
| 50 | +COMMENT ON COLUMN metadata.engine_error IS 'the engine application diagnose'; |
| 51 | +COMMENT ON COLUMN metadata.end_time IS 'the metadata end time'; |
| 52 | +COMMENT ON COLUMN metadata.priority IS 'the application priority, high value means high priority'; |
| 53 | +COMMENT ON COLUMN metadata.peer_instance_closed IS 'closed by peer kyuubi instance'; |
| 54 | + |
| 55 | +CREATE UNIQUE INDEX IF NOT EXISTS unique_identifier_index ON metadata(identifier); |
| 56 | +CREATE INDEX IF NOT EXISTS user_name_index ON metadata(user_name); |
| 57 | +CREATE INDEX IF NOT EXISTS engine_type_index ON metadata(engine_type); |
| 58 | +CREATE INDEX IF NOT EXISTS create_time_index ON metadata(create_time); |
| 59 | +CREATE INDEX IF NOT EXISTS priority_create_time_index ON metadata(priority DESC, create_time ASC); |
| 60 | + |
| 61 | +CREATE TABLE IF NOT EXISTS kubernetes_metadata( |
| 62 | + key_id bigserial PRIMARY KEY, |
| 63 | + identifier varchar(36) NOT NULL, |
| 64 | + context varchar(32), |
| 65 | + namespace varchar(255), |
| 66 | + pod_name varchar(255) NOT NULL, |
| 67 | + app_id varchar(128), |
| 68 | + app_state varchar(32), |
| 69 | + app_error text, |
| 70 | + create_time bigint NOT NULL, |
| 71 | + update_time bigint NOT NULL |
| 72 | +); |
| 73 | + |
| 74 | +COMMENT ON COLUMN kubernetes_metadata.key_id IS 'the auto increment key id'; |
| 75 | +COMMENT ON COLUMN kubernetes_metadata.identifier IS 'the identifier id, which is an UUID'; |
| 76 | +COMMENT ON COLUMN kubernetes_metadata.context IS 'the kubernetes context'; |
| 77 | +COMMENT ON COLUMN kubernetes_metadata.namespace IS 'the kubernetes namespace'; |
| 78 | +COMMENT ON COLUMN kubernetes_metadata.pod_name IS 'the kubernetes pod name'; |
| 79 | +COMMENT ON COLUMN kubernetes_metadata.app_id IS 'the application id'; |
| 80 | +COMMENT ON COLUMN kubernetes_metadata.app_state IS 'the application state'; |
| 81 | +COMMENT ON COLUMN kubernetes_metadata.app_error IS 'the application diagnose'; |
| 82 | +COMMENT ON COLUMN kubernetes_metadata.create_time IS 'the metadata create time'; |
| 83 | +COMMENT ON COLUMN kubernetes_metadata.update_time IS 'the metadata update time'; |
| 84 | + |
| 85 | +CREATE UNIQUE INDEX IF NOT EXISTS kubernetes_metadata_unique_identifier_index ON kubernetes_metadata(identifier); |
0 commit comments