Skip to content

branch-2.1: [fix](catalog) do cache load when cache value is not present #50188 - #50451

Merged
yiguolei merged 2 commits into
branch-2.1from
auto-pick-50188-branch-2.1
May 6, 2025
Merged

branch-2.1: [fix](catalog) do cache load when cache value is not present #50188#50451
yiguolei merged 2 commits into
branch-2.1from
auto-pick-50188-branch-2.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #50188

@github-actions
github-actions Bot requested a review from yiguolei as a code owner April 27, 2025 05:17
@morningman morningman closed this Apr 28, 2025
@morningman morningman reopened this Apr 28, 2025
@morningman

Copy link
Copy Markdown
Contributor

run buildall

@yiguolei yiguolei closed this Apr 28, 2025
@yiguolei yiguolei reopened this Apr 28, 2025
@yiguolei

Copy link
Copy Markdown
Contributor

run buildall

### What problem does this PR solve?

The MetaCache is used to cache the external table instance, like hive
table.
The type of cache value is `Optional<Table>`.

When first loading a key, if the key does not exist(table not exists),
the cacheloader
will return `null`, and finally there will be a cache entry `<key,
EmptyOptional>` in cache.

So when the second time to get this key from cache, the cache will
return the `EmptyOptional`
instead of try loading this key again from remote datasource.
But what we expect is to try loading the key from remote datasource if
it does not exist in cache.

So we need check the return result of the cache, if return result is
`null` or `EmptyOptional`,
we should load the key again. Otherwise, the following case may be
failed:

1. select a non-exist hive table in Doris.
2. create the table in Hive.
3. select the table in Doris, expect to get table succeed, but still
return "table does not exist".
@morningman
morningman force-pushed the auto-pick-50188-branch-2.1 branch from aaf8316 to b0c6941 Compare April 28, 2025 19:54
@morningman

Copy link
Copy Markdown
Contributor

run buildall

@morningman

Copy link
Copy Markdown
Contributor

run buildall

@yiguolei
yiguolei merged commit a9b948f into branch-2.1 May 6, 2025
@github-actions
github-actions Bot deleted the auto-pick-50188-branch-2.1 branch May 6, 2025 02:59
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.

2 participants