Voedger Internals
  • Introduction
  • 💡Concepts
    • Event Sourcing & CQRS
    • Editions (deprecated)
      • Community Edition
      • Standart Edition
      • Standart Edition (v1)
  • 🚀Server
    • Overview (Server)
    • Design
      • Query Processor
      • API Gateway implementation
      • N1 Cluster
      • N3 Cluster
      • N5 Cluster
      • Orchestration
      • Sequences
      • Packages overview
        • sys
        • registry
    • Features
      • API Gateway
        • API v2
          • Conventions
            • API URL
            • HTTP methods and processors
            • Naming conventions
            • Query constraints
            • Error handling
          • Documents and records
            • Create document or record
            • Update document or record
            • Deactivate document or record
            • Read document or record
            • Read from CDoc collection
          • Queries
            • Read from query
          • Views
            • Read from view
          • Commands
            • Execute command
          • BLOBs
            • Create BLOB
            • Read BLOB
          • Temporary BLOBs
            • Create temporary BLOB
            • Read temporary BLOB
          • Schemas
            • List app workspaces
            • List workspace roles
            • Read workspace role schema
        • API v1
          • API Conventions
          • BLOBs
      • Admin Endpoint
      • Clusters
        • Bootstrap
        • Monitoring
        • Secure prometheus and grafana
        • Alerting
        • Maintenance
          • SELECT, UPDATE
      • VVMs
      • Applications
        • Deploy Application
        • Sidecar Applications
      • AuthNZ
        • Issue Principal Token
        • Refresh Principal Token
        • Enrich Principal Token
        • ACL Rules
        • Global Roles
      • Data types
        • Core types
        • Small integers
        • Uniques With Multiple Fields
        • Verifiable Fields
      • Workspaces
        • Create Workspace
        • Deactivate Workspace
        • See also (Workspaces)
      • Invites
        • Invite to Workspace
        • Join Workspace
        • Leave Workspace
        • Cancel sent Invite
        • Cancel accepted Invite
        • Update Invite roles
      • Users
        • Create a new user
        • Change user password
        • Send Email
        • Reset password
        • Change Email
      • Notifications
        • Heartbeats
      • Devices
        • Create a new device
        • Join device to workspace
      • Jobs
      • DMBS Drivers
        • AmazonDB Driver
      • Frozen
        • Ephemeral Storage
        • Storage Extensions
  • 🛠️Framework
    • Overview (Framework)
    • Features
      • vpm
      • vpm init
      • vpm tidy
      • vpm baseline
      • vpm orm
      • vpm build
      • API for testing
  • Development
    • Requirements Management
    • Requirements Management (Overview)
Powered by GitBook
On this page
  • Motivation
  • Functional design: Prinicples
  • Technical design

Was this helpful?

Edit on GitHub
  1. 🚀Server
  2. Features
  3. Clusters
  4. Maintenance

SELECT, UPDATE

PreviousMaintenanceNextVVMs

Last updated 9 months ago

Was this helpful?

Motivation

  • login failed on Live Cluster again, it is necessary to fix things "manually".

Functional design: Prinicples

  • c.cluster.VSqlUpdate returns NewID field on insert table

  • <WSID> = NUMBER | 'a'NUMBER | '"'string_to_hash'"'

    • SELECT FROM owner.app.123.mypkg.MyView WHERE ... // Select from the workspace with WSID == 123

    • SELECT FROM owner.app.a1.mypkg.MyView WHERE ... // Select from the second app workspace

    • SELECT FROM owner.app."mylogin".mypkg.MyView WHERE ... // Select from the app workspace using hash("mylogin")

  • c.cluster.VSqlUpdate(if the query text starts with update)

  • DIRECT INSERT owner.app.<WSID>.mypkg.<viewOrdDoc> SET col1=val1, col2=val2, col3=val3, col4=val4

    • allowed for view only because it is impossible to generate recordID to insert a record

    • Event in target WS is NOT created

    • Projectors are not triggered

    • the record exists already with the same key -> error

  • DIRECT UPDATE owner.app.<WSID>.mypkg.<viewOrdDoc> SET col1=val1 col2=val2 WHERE col3=val2 AND col4=col4

    • Event in traget WS is NOT created

    • Projectors are not triggered

    • the record does not exist by the provided criteria or exists >1 record (not complete key is provided) -> error

  • For tables only

    • UPDATE owner.app.6789.mypkg.MyTable.<ID> SET col1=val1 col2=val2

    • INSERT owner.app.6789.mypkg.MyTable SET col1=val1 col2=val2

    • Invoke CUD in the target workspace (yes, "command from command" exceptional case)

    • Projectors are triggered

    • where clause is not allowed

  • UPDATE CORRUPTED owner.app.<partitionID>.sys.PLog.12344

  • UPDATE CORRUPTED owner.app.<WSID>.sys.WLog.12344

  • q.sys.SqlQuery

    • SELECT FROM owner.app.<partitionID>.PLog WHERE Offset=123 ...

    • SELECT FROM PLog WHERE Offset=123 ... // Current workspace PLog

    • SELECT FROM owner.app.<WSID>.mypkg.MyView WHERE ... // Arbitrary workspace

    • SELECT FROM mypkg.MyView WHERE ... // Current workspace

    • catch panic

      • data["!!!Panic"]

  • See

Technical design

  • istructs.IRecords.PutJSon()

  • istructs.IViewRecords.PutJSon()

  • the engine extracts owner.app.6789 from the sql query: SELECT FROM owner.app.6789.mypkg.MyView WHERE .. and replaces it to SELECT FROM mypkg.MyView WHERE..

  • UPDATE CORRUPTED owner.app.<WSID>.sys.WLog.12344

    • IDbEvent.Bytes() []byte

    • Event

      • QName: consts.QNameForError consts.QNameForCorruptedData (SysPackage, "Corrupted")

      • IEvents.GetSyncRawEventBuilder()

      • GenericRawEventBuilderParams.EventBytes = invalid event bytes

      • GenericRawEventBuilderParams.QName = consts.QNameForCorruptedData

  • Skip consts.QNameForCorruptedData in actualizers

github: vSQL: SELECT, UPDATE
test