Skip to content

GH Issue 1736: Keep calculated fields when renaming a sample type - #8186

Merged
cnathe merged 2 commits into
developfrom
fb_calcCol1736
Oct 19, 2026
Merged

cnathe merged 2 commits into
developfrom
fb_calcCol1736

Conversation

@cnathe

@cnathe cnathe commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Rationale

Renaming a sample type shortly after editing it could lose its calculated fields (GH Issue 1736). During the save, a background thread (e.g. search indexing) could reload the query metadata cache with the pre-rename row, and the calculated-field save then wrote that stale row back over the rename.

Related Pull Requests

Changes

  • Saving query metadata with a new name always stores it under the new name, even if the cached copy is stale
  • The query metadata cache is cleared again after the transaction commits, so a reload during the save doesn't leave stale data behind
  • Server-side test that forces the concurrent cache reload during a rename

- MetadataTableJSON.saveMetadata: set the updated query name on the QueryDef before saving, and use it for a new QueryDef row and new XML table
- QueryDefCache.uncache: also clear the folder's cache after commit/rollback, not just immediately
- QueryServiceImpl.TestCase: add a test that reloads the cache from another thread mid-rename
@cnathe cnathe self-assigned this Oct 15, 2026
@cnathe
cnathe requested a review from a team October 15, 2026 18:55
@cnathe
cnathe requested review from XingY and removed request for a team October 16, 2026 17:30
TableInfo rawTableInfo = getRawTableInfo(schema, queryName, updatedQueryName);
TablesDocument doc = null;
TableType xmlTable = null;
String savedQueryName = updatedQueryName != null ? updatedQueryName : queryName;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Debugging reveals that QueryManager.get().getQueryDef returns the queryDef under a different casing. So if a "Blood" sample type is renamed to "blood", QueryManager.get().getQueryDef("blood") returns the cached def for "Blood". This is probably harmless, especially for sample types since we don't allow casing different sample types.

@cnathe
cnathe merged commit 61c3078 into develop Oct 19, 2026
10 checks passed
@cnathe
cnathe deleted the fb_calcCol1736 branch October 19, 2026 14:32
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