Xiao-zhen-Liu commented on code in PR #4067: URL: https://github.com/apache/texera/pull/4067#discussion_r2550676196
########## common/workflow-core/src/main/scala/org/apache/texera/service/util/BigObjectManager.scala: ########## @@ -0,0 +1,67 @@ +/* + * 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. + */ + +package org.apache.texera.service.util + +import com.typesafe.scalalogging.LazyLogging + +import java.util.UUID + +/** + * Manages the lifecycle of BigObjects stored in S3. + * + * Handles creation, tracking, and cleanup of large objects that exceed + * normal tuple size limits. Objects are automatically cleaned up when + * their associated workflow execution completes. + */ +object BigObjectManager extends LazyLogging { + private val DEFAULT_BUCKET = "texera-big-objects" + + /** + * Creates a new BigObject reference. + * The actual data upload happens separately via BigObjectOutputStream. + * + * @return S3 URI string for the new BigObject (format: s3://bucket/key) + */ + def create(): String = { + S3StorageClient.createBucketIfNotExist(DEFAULT_BUCKET) + + val objectKey = s"objects/${System.currentTimeMillis()}/${UUID.randomUUID()}" + val uri = s"s3://$DEFAULT_BUCKET/$objectKey" + + uri + } + + /** + * Deletes all big objects from the bucket. + * + * @throws Exception if the deletion fails + * @return Unit + */ + def delete(): Unit = { + try { + S3StorageClient.deleteDirectory(DEFAULT_BUCKET, "objects") Review Comment: `create` is for creating one bigObject, while `delete` is for all big objects. The names could be misleading. ########## common/workflow-core/src/main/scala/org/apache/amber/core/tuple/BigObject.java: ########## Review Comment: I wonder why does this code need to be java instead of scala? ########## common/workflow-core/src/main/scala/org/apache/texera/service/util/BigObjectManager.scala: ########## @@ -0,0 +1,67 @@ +/* + * 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. + */ + +package org.apache.texera.service.util + +import com.typesafe.scalalogging.LazyLogging + +import java.util.UUID + +/** + * Manages the lifecycle of BigObjects stored in S3. + * + * Handles creation, tracking, and cleanup of large objects that exceed + * normal tuple size limits. Objects are automatically cleaned up when + * their associated workflow execution completes. Review Comment: I think currently it is not "associated workflow"? Any workflow deletion / new execution will trigger the delete. Please also update the PR description (it is not "related" big objects) and highlight this behavior. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
