palashc commented on code in PR #2208: URL: https://github.com/apache/phoenix/pull/2208#discussion_r2181280366
########## phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCStreamIT.java: ########## @@ -168,6 +172,31 @@ public void testOnlyOneStreamAllowed() throws Exception { assertStreamStatus(conn, tableName, streamName, CDCUtil.CdcStreamStatus.ENABLING); } + @Test + public void testStreamMetadataWhenTableIsDropped() throws SQLException { + Connection conn = newConnection(); + String schemaName = "\"" + generateUniqueName().toLowerCase() + "\""; + String tableName = SchemaUtil.getTableName(schemaName, "\"" + generateUniqueName().toLowerCase() + "\""); + String create_table_sql = "CREATE TABLE " + tableName + " ( k INTEGER PRIMARY KEY," + " v1 INTEGER, v2 DATE)"; + conn.createStatement().execute(create_table_sql); + String cdcName = "\"" + generateUniqueName().toLowerCase() + "\""; + String cdc_sql = "CREATE CDC " + cdcName + " ON " + tableName; + conn.createStatement().execute(cdc_sql); + String drop_table_sql = "DROP TABLE " + tableName; + conn.createStatement().execute(drop_table_sql); + // check if stream metadata is cleared + Assert.assertNull(new MetaDataClient(conn.unwrap(PhoenixConnection.class)) + .getStreamNameIfCDCEnabled(SchemaUtil.getUnEscapedFullName(tableName))); + ResultSet rs = conn.createStatement().executeQuery( + "SELECT * FROM SYSTEM.CDC_STREAM WHERE TABLE_NAME='" + tableName + "'"); + Assert.assertFalse(rs.next()); + // should be able to re-create same table with same cdc name + conn.createStatement().execute(create_table_sql); + conn.createStatement().execute(cdc_sql); + Assert.assertNotNull(new MetaDataClient(conn.unwrap(PhoenixConnection.class)) + .getStreamNameIfCDCEnabled(SchemaUtil.getUnEscapedFullName(tableName))); Review Comment: @virajjasani the test already does that, right? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org