d  Admin www.jsoftware.com
J database - J language
columnar analytics

Admin is done in the Jd task. Admin names have jd prefix and are defined in jd locale. See tutorial admin_tut.

jd... access/admin verbs in z locale:
jdaccess jdadmin jdadminx

jd... admin util verbs in jd locale:
jdadminfp jdadminlk jdadminop jdadminup

admin topics:
admin.ijs custom.ijs

jd... utility verbs in jd locale:
jdcdef jdclocs jdcols jdcreatefolder jddamage jddeletefolder jddeletefolderok jddropstop jdex jdfixcolnames jdfread jdfrom jdfroms jdfwrite jdgl jdgs jdlinkmove jdlinkset jdlinktargets jdlogijfshow jdlogtxtshow jdpath jdrt jdserverstop jdshare jdshuffle jdtables jdtesterrors jdtests


set DAN (db access name), user/pswd, and server for jd ops server intask - op runs in current J task server localhost:x - op runs in J JHS task at port x server ipaddress:x - op runs in J JHS task at ipaddress port x server hostname:x - op runs in J JHS task at hostname t port x SSH tunnel can securely connect localhost:x to J task on server jdaccess 'test me/xx intask' NB. DAN test, user/pswd u/p jdaccess 'foo' NB. same as 'foo u/p intask' jdaccess 'zz me/xx localhost:65002' jdaccess '' NB. report jdaccess 0 NB. clear access


load db admin.ijs to make db available jdaccess is done for first dan and user/pswd in admin.ijs opens all tables/cols and maps all mapped files jd'validate' done to validate db jdadmin 'ab' NB. make ~temp/jd/ab available jdadmin '.../ab' NB. make .../ab available jdadmin '' NB. report jdadmin 0 NB. clear all admin and release all locks DAN (db access name) maps to folder,user/pswds,ops different DANs can access the same or different folders DAN rules set by admin.ijs in db folder creates default admin.ijs if it does not exist default admin.ijs - dan is last path folder - u/p is user/pswd lock on db folder prevents interference by other tasks jdadmin '...' NB. gets lock jdadmin 0 NB. releases all locks


jdadminx'aa' NB. create new database ~temp/jd/aa jdadminx'.../bb' NB. create new database .../bb delete old folder, create new db folder, do jdadmin new database can be created in an empty folder new database overwrites old database unless dropstop set fails if folder: is a jd folder but not class database is a jd folder with dropstop is not a jd folder and is not empty if jdadminx fails, you can force delete of the folder with: 'force'jddeletefolder_jd_'...'


admin.ijs - in db folder - loaded by jdadmin *** admin.ijs default for jdadmin'ab' 'ab' jdadminfp '' NB. DAN ab maps to ~temp/jd/ab 'ab' jdadminup 'u/p' NB. requires default user/pswd 'ab' jdadminop '*' NB. allow all ops *** *** admin.ijs example 'test' jdadminfp '' NB. DAN test maps to this db folder 'test' jdadminup 'u/p' NB. requires this user/pswd 'test' jdadminop '*' NB. allow all ops 'testro' jdadminfp '' NB. DAN testro maps to this db folder 'testro' jdadminup 'ab/de gh/jk' NB. requires these user/pswds 'testro' jdadminop 'read reads' NB. allow only read and reads *** admin.ijs end jdadminfp/jdadminup/jdadminop usually run only in admin.ijs use directly for temp changes or tests


custom.ijs - in db folder - loaded in db locale when db opened defines: dynamic - creates ref/reference cols jd_xxx - jd op ... addagg ... - custom aggregation jd'loadcustom' NB. reloads custom.ijs tutorials custom and aggregation


set DAN file path 'test' jdadminfp_jd_ '' jdadminfp_jd_ '' NB. report


set lock on DAN db folder 'test' jdadminlk_jd_ '' jdadminlk_jd_ '' NB. report


set ops allowed with DAN 'test' jdadminop_jd_ 'read reads insert' jdadminop_jd_ '' NB. report


set user/pswds allowed with DAN 'test' jdadminup_jd_ 'fred/secret sam/birthday' jdadminup_jd_ '' NB. report


jdcdef d NB. col defs for createtable from labeled row data see tutorial table_from_array


jdclocs t;c NB. return col locales t is '' for all tables or 'tab' for just that table c is '' for all cols or 'col' for just that col result is sorted by table names col names int a table are in created order followed by jd... names


jdcols'tab' NB. return col names,.locales sorted by name


jdcreatefolder'~temp/jd/a/b' NB. creates required folders for path


jddamage_jd_'reason' NB. writes db jddamage file - prevents jd ops jddamage_jd_'' NB. erases db jddamage file - allows jd ops


jddeletefolder_jd_'~/jd/test' used internally by jd drop... ops see drop/delete allowed if jddeletok exists not allowed if jddropstop exists not allowed if too few /s ('/abc/def' ok - '/abc' fails) allowed if empty or jd folder (jdclass exists) or in ~temp not allowed jddeletefolderok writes jddeleteok to override tests


jddeletefolderrok_jd_'~/jd/test' writes jddeletok file to folder to allow jddeletefolder


[1] jddropstop '' NB. write jddropstop file in folder and subfolders [1] jddropstop 'tab' [1] jddropstop 'tab col' 0 jddropstop '' NB. erase jddropstop file in folder and subfolders 1 jddropstop 'tab' 1 jddropstop 'tab col' dropdb/droptable/dropcol fail if there is a jdddropstop file in the folder tutorial dropstop


jdex'insert' NB. run insert example from User


jdfixcolnames d NB. make col names valid in labeled row data table.col -> table-col blank -> _


jdflush_jd_'' pm (performance measurement) scripts use jdflush for more accurate benchmarks Windows: noop Linux: calls jdflush shell script define jdflush shell script in path as appropriate for your system *** #!/bin/bash sudo sync sudo blockdev --flushbuf /dev/sda sudo blockdev --flushbuf /dev/sdb sudo sysctl vm/drop_caches=3 ***


fread with handle limit error assert


'col' jdfrom_jd_ jd'read from f' NB. col data from raed


'col' jdfroms_jd_ jd'reads from f' NB. col data from reads


fwrite with handle limit error assert


jdgl_jd_'tab' NB. get locale for tab jdgl_jd_'tab col' NB. get locale for tab col


jdgs_jd_'tab' NB. get state for tab jdgs_jd_'tab col' NB. get state for tab col


jdlinkmove_jd_ 'tab/col ~temp/linker' col data files can be moved (usually to another drive) folder structure updated so col folder links to new location some reasons for relocating cols - improve performance by having i/o on multiple drives - take advantage of particular drives - ssd or slower or faster or high capacity tutorial link


jdlinkset_jd_ 0 : 0 f/int ~temp/linker0 f/varbyte ~temp/linker1 ) jdlinkset_jd_'' NB. report db links.txt set (tab/col path) definitions in db folder link.txt file create col (including csvrd/csvrestore) use link.txt to do folder links tutorial link


jdlinktargets_jd_'' NB. report jdlinkmove/jdlinkset folder targets tutorial link


jdlogijfshow_jd_'' NB. log.ijf summary jdlogijfshow_jd_ 0 NB. component 0 tutorial log


jdlogtxtshow_jd_ 10 NB. log.txt last 10 lines tutorial log


jdpath_jd_'' NB. path (ending in /) to db folder


jdrt_jd_'' NB. list tutorials jdrt_jd_'intro' NB. run tutorial


jdserverserverstop_jd_'' Sets OKURL_jhs_ to empty to stop Jd from serving clients.


jdshare_jd_'rwrwrw' NB. rw or r- or -- for owner/group/others normally the Jd task account owns the db folder giving another account access to the db folder allows Jd tasks running as that account to access the db lock prevents problems with multiple Jd tasks running as the owner or another account from using the db at the same time adjust permissions to access the db from another account best done with host tools by someone who understands security jdshare might be useful in simple situations


jdshuffle_jd_ 'tab' Randomly deletes and reinserts rows. Table at the end has the same rows it started with. Used in tests for proper functioning of dynamic cols.


jdtables_jd_'tab' table names,.locales sorted by names


jdtesterrors_jd_'' NB.test error formatting


[0 or 1] jdtests_jd_ y NB. 1 echos names as tests are run '' csv-tests, build-demos, and all tests/tutorials 'fast' skip csv-tests and build-demos 'csv' just csv-tests ~addons/data/jd/test/core original non api tests (0!:3 implied assert on every line) ~addons/data/jd/test tests with asserts ~addons/data/jd/tutorial tutorials with asserts ~addons/data/jd/demo scripts that build/test northwind,sandp,sed,vr