You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/05/02 23:00:00 UTC

[jira] [Commented] (PHOENIX-6932) Update LAST_DDL_TIMESTAMP for index table when add/drop/alter indexes.

    [ https://issues.apache.org/jira/browse/PHOENIX-6932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17718750#comment-17718750 ] 

ASF GitHub Bot commented on PHOENIX-6932:
-----------------------------------------

tkhurana commented on code in PR #1595:
URL: https://github.com/apache/phoenix/pull/1595#discussion_r1183120139


##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexIT.java:
##########
@@ -1435,4 +1440,52 @@ public void testReturnedTimestamp() throws Exception {
         }
     }
 
+    /**
+     * Tests that we add LAST_DDL_TIMESTAMP when we create an index and we update LAST_DDL_TIMESTAMP when we update
+     * an index.
+     * @throws Exception
+     */
+    @Test
+    public void testLastDDLTimestampOnIndexes() throws Exception {
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IND_" + generateUniqueName();
+        String fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
+        String fullIndexName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
+
+        String ddl ="CREATE TABLE " + fullTableName + TestUtil.TEST_TABLE_SCHEMA + tableDDLOptions;
+        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+            conn.setAutoCommit(true);
+            Statement stmt = conn.createStatement();
+            stmt.execute(ddl);
+            ddl = "CREATE " + (localIndex ? "LOCAL" : "") + (uncovered ? "UNCOVERED" : "")

Review Comment:
   Good to test the async index creation code path which first creates the index in building state and then call IndexTool to build the index which makes the index active. For example:





> Update LAST_DDL_TIMESTAMP for index table when add/drop/alter indexes.
> ----------------------------------------------------------------------
>
>                 Key: PHOENIX-6932
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6932
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Rushabh Shah
>            Assignee: Rushabh Shah
>            Priority: Major
>
> Currently we use  LAST_DDL_TIMESTAMP only for data tables.
> Create LAST_DDL_TIMESTAMP when we create an index.
> Update LAST_DDL_TIMESTAMP when we alter index like  disable, rebuild, unusable, usable.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)