Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Unify the order of procedure loading properties #4657

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

askwang
Copy link
Contributor

@askwang askwang commented Dec 7, 2024

Purpose

If the table property have related properties, we do not need to configure them separately in procedure, unify them for expire_partitions and expire_snapshots.

  1. Properties loading priority: procedure param > options param > table properties.
  2. Add 'options' parameter for some procedures, we can control some behaviors, such as manifest merge.

Tests

API and Format

Documentation

throws Catalog.TableNotExistException {
FileStoreTable fileStoreTable = (FileStoreTable) table(tableId);
Map<String, String> dynamicOptions = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These code is same as three ExpirePartitionsProcedure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thks, added a unified util method.

@askwang askwang changed the title [core] Expire partitions load table properties first then procedure parameters [core] Unify the order of procedure loading properties Dec 17, 2024

PartitionExpire partitionExpire =
new PartitionExpire(
TimeUtils.parseDuration(expirationTime),
fileStore.options().partitionExpireTime(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use newPartitionExpire in FileStore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, good idea

map.put(CoreOptions.PARTITION_TIMESTAMP_PATTERN.key(), timestampPattern);

// check expiration time not null
Preconditions.checkNotNull(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this maybe can be checked in FileStore internal

CoreOptions tableOptions = ((FileStoreTable) table).store().options();
ExpireConfig.Builder builder =
ProcedureUtils.fillInSnapshotOptions(
tableOptions, retainMax, retainMin, olderThanStr, maxDeletes);
int deleted = expireSnapshots.config(builder.build()).expire();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

table.newExpireSnapshots() should include the dynamicOptions instead of inserting it through the builder, if not maybe we should fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. We should not update properties using the builder after table.newExpireSnapshots() which should included in dynamicOptions.

I will remove the builder way in another pr, WDYT? @Zouxxyy

@askwang askwang force-pushed the load-table-prop-first branch from 75a3ae3 to a6aa2be Compare December 18, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants