diff --git a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/CatalogMetaMapper.java b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/CatalogMetaMapper.java index 652cf52cadd..038b4256f0b 100644 --- a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/CatalogMetaMapper.java +++ b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/CatalogMetaMapper.java @@ -137,14 +137,14 @@ Integer updateCatalogMeta( @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE catalog_id = #{catalogId} AND deleted_at = 0") Integer softDeleteCatalogMetasByCatalogId(@Param("catalogId") Long catalogId); @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE metalake_id = #{metalakeId} AND deleted_at = 0") Integer softDeleteCatalogMetasByMetalakeId(@Param("metalakeId") Long metalakeId); } diff --git a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetMetaMapper.java b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetMetaMapper.java index 33906f8b305..885a8d89908 100644 --- a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetMetaMapper.java +++ b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetMetaMapper.java @@ -190,28 +190,28 @@ Integer updateFilesetMeta( @Update( "UPDATE " + META_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE metalake_id = #{metalakeId} AND deleted_at = 0") Integer softDeleteFilesetMetasByMetalakeId(@Param("metalakeId") Long metalakeId); @Update( "UPDATE " + META_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE catalog_id = #{catalogId} AND deleted_at = 0") Integer softDeleteFilesetMetasByCatalogId(@Param("catalogId") Long catalogId); @Update( "UPDATE " + META_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE schema_id = #{schemaId} AND deleted_at = 0") Integer softDeleteFilesetMetasBySchemaId(@Param("schemaId") Long schemaId); @Update( "UPDATE " + META_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE fileset_id = #{filesetId} AND deleted_at = 0") Integer softDeleteFilesetMetasByFilesetId(@Param("filesetId") Long filesetId); } diff --git a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetVersionMapper.java b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetVersionMapper.java index b2df6ab43cb..af08416ea09 100644 --- a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetVersionMapper.java +++ b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/FilesetVersionMapper.java @@ -73,28 +73,28 @@ void insertFilesetVersionOnDuplicateKeyUpdate( @Update( "UPDATE " + VERSION_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE metalake_id = #{metalakeId} AND deleted_at = 0") Integer softDeleteFilesetVersionsByMetalakeId(@Param("metalakeId") Long metalakeId); @Update( "UPDATE " + VERSION_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE catalog_id = #{catalogId} AND deleted_at = 0") Integer softDeleteFilesetVersionsByCatalogId(@Param("catalogId") Long catalogId); @Update( "UPDATE " + VERSION_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE schema_id = #{schemaId} AND deleted_at = 0") Integer softDeleteFilesetVersionsBySchemaId(@Param("schemaId") Long schemaId); @Update( "UPDATE " + VERSION_TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE fileset_id = #{filesetId} AND deleted_at = 0") Integer softDeleteFilesetVersionsByFilesetId(@Param("filesetId") Long filesetId); } diff --git a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/MetalakeMetaMapper.java b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/MetalakeMetaMapper.java index 2336a6761a6..d1cb2d1ea73 100644 --- a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/MetalakeMetaMapper.java +++ b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/MetalakeMetaMapper.java @@ -122,7 +122,7 @@ Integer updateMetalakeMeta( @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE metalake_id = #{metalakeId} AND deleted_at = 0") Integer softDeleteMetalakeMetaByMetalakeId(@Param("metalakeId") Long metalakeId); } diff --git a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/SchemaMetaMapper.java b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/SchemaMetaMapper.java index 3e8723b053d..009cdcb20e5 100644 --- a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/SchemaMetaMapper.java +++ b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/SchemaMetaMapper.java @@ -132,21 +132,21 @@ Integer updateSchemaMeta( @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE schema_id = #{schemaId} AND deleted_at = 0") Integer softDeleteSchemaMetasBySchemaId(@Param("schemaId") Long schemaId); @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE metalake_id = #{metalakeId} AND deleted_at = 0") Integer softDeleteSchemaMetasByMetalakeId(@Param("metalakeId") Long metalakeId); @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE catalog_id = #{catalogId} AND deleted_at = 0") Integer softDeleteSchemaMetasByCatalogId(@Param("catalogId") Long catalogId); } diff --git a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/TableMetaMapper.java b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/TableMetaMapper.java index f1de8a51bd5..331847f8cdc 100644 --- a/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/TableMetaMapper.java +++ b/core/src/main/java/com/datastrato/gravitino/storage/relational/mapper/TableMetaMapper.java @@ -127,28 +127,28 @@ Integer updateTableMeta( @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE table_id = #{tableId} AND deleted_at = 0") Integer softDeleteTableMetasByTableId(@Param("tableId") Long tableId); @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE metalake_id = #{metalakeId} AND deleted_at = 0") Integer softDeleteTableMetasByMetalakeId(@Param("metalakeId") Long metalakeId); @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE catalog_id = #{catalogId} AND deleted_at = 0") Integer softDeleteTableMetasByCatalogId(@Param("catalogId") Long catalogId); @Update( "UPDATE " + TABLE_NAME - + " SET deleted_at = UNIX_TIMESTAMP()" + + " SET deleted_at = UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)) * 1000.0" + " WHERE schema_id = #{schemaId} AND deleted_at = 0") Integer softDeleteTableMetasBySchemaId(@Param("schemaId") Long schemaId); }