Eduard Lebedyuk · May 27, 2021 go to post

If you're talking about drawn connections:

They are defined in OnGetConnections method, check what does it do:

/// Return an array of connections for drawing lines on the config diagram
ClassMethod OnGetConnections(Output pArray As %String, pItem As Ens.Config.Item)
{
}

That said, the drawn connections and this method are just visual docs. Developers are expected to provide this method and keep it relevant but in no way are they beholden to do it.

The only way to know what does any BH do is to go through the code or visual trace.

Eduard Lebedyuk · May 21, 2021 go to post

What's your linefeed symbol?

Also you have a string, not a stream.

Anyway, try this:

set nl = $$$NL
set str = "2334" _ nl _ "3434" _ nl _ "5543" _ nl _ "4334"
for i = 1:1: $length(str, nl) {
    set value = $piece(str, nl, i)
    write value, !
}
Eduard Lebedyuk · May 19, 2021 go to post

%xsd.base64Binary is essentially a string so you can't write more than 3,5 mb there.

Change property definition to %Stream.GlobalCharacter instead.

Eduard Lebedyuk · May 19, 2021 go to post

Global buffers are one of the keys to performance.   

Yes, that's why if streams are to be stored in the db they should be stored in a separate db with distinct block size and separate global buffers.

Eduard Lebedyuk · May 18, 2021 go to post

There are a lot of considerations.

Questions:

  1. Can you describe what are you going to do with that streams (or files I guess)?
  2. Are they immutable?
  3. Are they text or binary?
  4. Are they already encrypted or zipped?
  5. Average stream size?
Eduard Lebedyuk · May 18, 2021 go to post

Replace:

do fileStream.Rewind()
while 'fileStream.AtEnd {
           set tsRequest.DocumentData = tsRequest.DocumentData_fileStream.Read(30000)
}

with

do tsRequest.DocumentData.CopyFrom(fileStream)

or even:

do tsRequest.DocumentData.CopyFrom(pRequest.Stream)
Eduard Lebedyuk · May 4, 2021 go to post

Some time ago I was working on the issue of a fast data generation for an arbitrary data model.

Data model was connected (object properties) and so to generation was going in stages from low-cardinality independent tables (i.e. product) to high-cardinality dependent tables (i.e. orders). Furthermore tables did not have continuous IDs, there were gaps (due to sharding in my case but even if there's no hard delete we might want to exclude soft deleted rows).

Here's the approach I used.

1. For a given class build a local with all ranges of IDs:

/// d ##class().Ranges()
ClassMethod Ranges(class As %Dictionary.Classname, Output ranges)
{
    kill ranges    

    set table = ##class(%CSP.UI.Portal.SQL.Home).Quoter2(##class(%DeepSee.Utils).%GetSQLTableName(class))
    
    set rs = ##class(%SQL.Statement).%ExecDirect(,"SELECT ID FROM " _ table _ " ORDER BY ID ASC")

    do rs.%Next()
    set start = rs.ID
    set end = rs.ID
    while rs.%Next() {
        if rs.ID - 1 = end {
            d $i(end)
        } else {
            set ranges($i(ranges)) = $lb(start, end-start)
            set start = rs.ID
            set end = rs.ID
        }
    }
    
    set ranges($i(ranges)) = $lb(start, end-start)
}

This method accepts class name and returns this structure:

ranges(num) = $lb(startID, length)

2. Call GetRandomInRanges method to get random ID from ranges local:

/// d ##class().GetRandomInRanges()
ClassMethod GetRandomInRanges(ByRef ranges)
{
    set sum = 0
    
    for i=1:1:ranges {
        set sum = sum + $lg(ranges(i),2)
    }
    
    set threshold = $random(sum) + 1
    
    set sum = 0
    for chunk=1:1:ranges {
        set sum = sum + $lg(ranges(chunk),2)
        quit:sum>=threshold
    }    
    
    set val = ranges(chunk)
    if $listvalid(val) {
        if $ll(val)=2 {
            set val = $lg(val, 1) + $random($lg(val, 2))
        } else {
            set:$listvalid(val) val = $lg(val, ($random($ll(val))+1))
        }
    }
    
    quit val
}

This method guarantees that returned IDs would conform to the normal distribution.

Ranges should be called once and GetRandomInRanges  can be called as often as needed.

Eduard Lebedyuk · Apr 28, 2021 go to post

is it possible to get the values of the object to use as parameter of the query?

I don't think so. SQL must work from xDBC context and objects don't exist there.

How would you call your function from Management Portal or any SQL Editor?

Eduard Lebedyuk · Apr 28, 2021 go to post

Maybe you can go into Application Roles tab and add %ALL role.

After that try again from private window or another browser.

Unknown User must also be enabled.

This is only for dev/testing.

Eduard Lebedyuk · Apr 28, 2021 go to post

By default Content is a stream. Try converting it into dynamic object

set content = {}.$fromJSON(%request.Content)
Eduard Lebedyuk · Apr 20, 2021 go to post

Why? Your shell is run under your user (vrogers). You use $ZF(-1) to spawn a child process which inherits everything from parent. Ergo, $ZF(-1) started from shell is also run under your OS user.

Eduard Lebedyuk · Apr 20, 2021 go to post

Correct.

Terminal sessions are run under OS user who runs the terminal.

CSP and Interoperability jobs run under cacheusr or irisusr by default or some other custom user if you specified that during installation.

Eduard Lebedyuk · Apr 18, 2021 go to post

During installation you specified the user who owns the system. Try running cstop as that user.

Eduard Lebedyuk · Apr 18, 2021 go to post

You should check for disk speed and latency especially under heavy load. HS should be given a separate disk(s). Hyper-converged infrastructure like you describe can invite performance lags in unexpected ways.

Calling @Mark.Bolinsky.