Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ CREATE TABLE `x_trx_log_v2` (
PRIMARY KEY (`id`),
KEY `x_trx_log_v2_FK_added_by_id` (`added_by_id`),
KEY `x_trx_log_v2_cr_time` (`create_time`),
KEY `x_trx_log_v2_action` (`action`),
KEY `x_trx_log_v2_trx_id` (`trx_id`)
)ROW_FORMAT=DYNAMIC;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- 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.

drop procedure if exists create_index_for_x_trx_log_v2;

delimiter ;;
create procedure create_index_for_x_trx_log_v2() begin
if exists (SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_schema=DATABASE() AND table_name='x_trx_log_v2') then
if not exists (SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_schema=DATABASE() AND table_name='x_trx_log_v2' AND index_name='x_trx_log_v2_action') then
CREATE INDEX x_trx_log_v2_action ON x_trx_log_v2(action);
end if;
end if;
end;;

delimiter ;
call create_index_for_x_trx_log_v2();
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,7 @@ CREATE INDEX x_resource_FK_parent_id ON x_resource (parent_id);
CREATE INDEX x_resource_cr_time ON x_resource(create_time);
CREATE INDEX x_resource_up_time ON x_resource (update_time);
CREATE INDEX x_trx_log_v2_FK_added_by_id ON x_trx_log_v2 (added_by_id);
CREATE INDEX x_trx_log_v2_action ON x_trx_log_v2 (action);
CREATE INDEX x_trx_log_v2_cr_time ON x_trx_log_v2 (create_time);
CREATE INDEX x_trx_log_v2_trx_id ON x_trx_log_v2 (trx_id);
CREATE INDEX x_user_FK_added_by_id ON x_user (added_by_id);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- 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.
-- sync_source_info CLOB NOT NULL,

DECLARE
v_index_exists number:=0;
v_table_exists number := 0;
BEGIN
SELECT COUNT(*) INTO v_table_exists FROM USER_TABLES WHERE TABLE_NAME = upper('x_trx_log_v2');
IF (v_table_exists > 0) THEN
SELECT COUNT(*) INTO v_index_exists FROM USER_INDEXES WHERE INDEX_NAME = upper('x_trx_log_v2_action') AND TABLE_NAME= upper('x_trx_log_v2');
IF (v_index_exists = 0) THEN
execute IMMEDIATE 'CREATE INDEX x_trx_log_v2_action ON x_trx_log_v2(action)';
commit;
END IF;
END IF;
END;/
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,7 @@ CREATE INDEX x_resource_FK_parent_id ON x_resource(parent_id);
CREATE INDEX x_resource_cr_time ON x_resource(create_time);
CREATE INDEX x_resource_up_time ON x_resource(update_time);
CREATE INDEX x_trx_log_v2_FK_added_by_id ON x_trx_log_v2(added_by_id);
CREATE INDEX x_trx_log_v2_action ON x_trx_log_v2(action);
CREATE INDEX x_trx_log_v2_cr_time ON x_trx_log_v2(create_time);
CREATE INDEX x_trx_log_v2_trx_id ON x_trx_log_v2(trx_id);
CREATE INDEX x_user_FK_added_by_id ON x_user(added_by_id);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
-- 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.

select 'delimiter start';
CREATE OR REPLACE FUNCTION create_index_for_x_trx_log_v2()
RETURNS void AS $$
DECLARE
v_attnum1 integer := 0;
v_table_exists integer := 0;
BEGIN
SELECT COUNT(*) INTO v_table_exists FROM pg_class WHERE relname = 'x_trx_log_v2';
IF v_table_exists > 0 THEN
select attnum into v_attnum1 from pg_attribute where attrelid in(select oid from pg_class where relname='x_trx_log_v2') and attname in('action');
IF v_attnum1 > 0 THEN
IF not exists (select * from pg_index where indrelid in(select oid from pg_class where relname='x_trx_log_v2') and indkey[0]=v_attnum1) THEN
CREATE INDEX x_trx_log_v2_action ON x_trx_log_v2(action);
END IF;
END IF;
END IF;
END;
$$ LANGUAGE plpgsql;
select 'delimiter end';

select create_index_for_x_trx_log_v2();
select 'delimiter end';
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,8 @@ CREATE NONCLUSTERED INDEX x_resource_up_time ON dbo.x_resource(update_time ASC)
GO
CREATE NONCLUSTERED INDEX x_trx_log_v2_FK_cr_time ON dbo.x_trx_log_v2(create_time ASC)
GO
CREATE NONCLUSTERED INDEX x_trx_log_v2_action ON dbo.x_trx_log_v2(action ASC)
GO
CREATE NONCLUSTERED INDEX x_trx_log_v2_FK_added_by_id ON dbo.x_trx_log_v2(added_by_id ASC)
GO
CREATE NONCLUSTERED INDEX x_trx_log_v2_FK_trx_id ON dbo.x_trx_log_v2(trx_id ASC)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- 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.

IF EXISTS(select * from SYS.SYSTABLES where tname = 'x_trx_log_v2') THEN
IF EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_trx_log_v2' and cname = 'action') THEN
CREATE INDEX IF NOT EXISTS x_trx_log_v2_action ON x_trx_log_v2(action);
END IF;
END IF;
GO

EXIT
Original file line number Diff line number Diff line change
Expand Up @@ -3446,7 +3446,11 @@ CREATE NONCLUSTERED INDEX [x_resource_up_time] ON [x_resource]
[update_time] ASC
)
WITH (SORT_IN_TEMPDB = OFF,DROP_EXISTING = OFF,IGNORE_DUP_KEY = OFF,ONLINE = OFF) ON [PRIMARY]

CREATE NONCLUSTERED INDEX [x_trx_log_v2_action] ON [x_trx_log_v2]
(
[action] ASC
)
WITH (SORT_IN_TEMPDB = OFF,DROP_EXISTING = OFF,IGNORE_DUP_KEY = OFF,ONLINE = OFF) ON [PRIMARY]
CREATE NONCLUSTERED INDEX [x_trx_log_v2_cr_time] ON [x_trx_log_v2]
(
[create_time] ASC
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- 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.
GO
IF OBJECT_ID('x_trx_log_v2') IS NOT NULL
BEGIN
IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name = 'x_trx_log_v2_action' AND object_id = OBJECT_ID('x_trx_log_v2'))
BEGIN
CREATE NONCLUSTERED INDEX [x_trx_log_v2_action] ON [x_trx_log_v2]
(
[action] ASC
)
WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]
END
END
Go

EXIT;
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public RangerTrxLogV2Service() {

sortFields.add(new SortField("id", "obj.id", true, SortField.SORT_ORDER.DESC));
sortFields.add(new SortField("createDate", "obj.createTime", true, SortField.SORT_ORDER.DESC));
sortFields.add(new SortField("addedByUserId", "obj.addedByUserId", true, SortField.SORT_ORDER.DESC));
sortFields.add(new SortField("action", "obj.action", true, SortField.SORT_ORDER.DESC));
}

public List<SearchField> getSearchFields() {
Expand Down
Loading