Skip to content

Split static and dynamic namespace contexts#2600

Open
GuntherRademacher wants to merge 1 commit intoBaseXdb:mainfrom
GuntherRademacher:namespace-context
Open

Split static and dynamic namespace contexts#2600
GuntherRademacher wants to merge 1 commit intoBaseXdb:mainfrom
GuntherRademacher:namespace-context

Conversation

@GuntherRademacher
Copy link
Member

The namespace context previously mixed statically declared and dynamically scoped namespaces in NSContext. As NSContext instances are shared per compiled module, this led to concurrency issues when dynamic namespace bindings were modified at runtime via xquery:fork-join.

This change separates concerns:

  • NSContext now holds only statically declared (module) namespaces
  • the new NSDynContext maintains the dynamic namespace stack and is owned by QueryContext
  • NSDynContext instances are duplicated when QueryContext is forked, ensuring thread isolation
  • namespace resolution now combines dynamic and static parts explicitly

This fixes concurrency issues with dynamic namespace handling. It handles all existing BaseX and QT4 tests in the same way as before. However this new test would fail:

    query("<x xmlns:x=\"X\">{#x:b = text{'x:b'}}</x>", "<x xmlns:x=\"X\">true</x>");

The reason is in QNm.compare: it needs access to the dynamic namespaces, which it does no longer have with the changes presented here. And adding QueryContext qc to the signature will cause a whole lot of further changes.

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.

1 participant