Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DataSource.audit and update operation which affects no rows

    SmartClient Version: v10.0p_2015-08-06/Enterprise Deployment (built 2015-08-06)

    Hello, I have an update operation with allowMultiUpdate=true, which in some cases affects no rows.
    The DataSource has the audit feature enabled, and it is inserting always one record, when multiple records are updated, and even if no update is actually performed:

    Code:
    2015-08-06 16:54:17,476 INFO  SQLDriver [builtinApplication.creaLotto] Executing SQL update on 'dbJpcEP': UPDATE DBSALES.JF_MOVIMENTI SET EXPORTED_TS=TO_DATE('2015-08-06 16:54:17','YYYY-MM-DD HH24:MI:SS') WHERE ((JF_MOVIMENTI.PAYMENT_DATE >= TO_DATE('2015-07-01 00:00:00','YYYY-MM-DD HH24:MI:SS') AND JF_MOVIMENTI.PAYMENT_DATE <= TO_DATE('2015-07-31 00:00:00','YYYY-MM-DD HH24:MI:SS') AND JF_MOVIMENTI.PAYMENT_DATE IS NOT NULL) AND (JF_MOVIMENTI.EXPORTED_TS IS NULL) AND (JF_MOVIMENTI.FL_SCART = 'F' AND JF_MOVIMENTI.FL_SCART IS NOT NULL)) 
    2015-08-06 16:54:17,480 WARN  SQLDataSource [builtinApplication.creaLotto] update operation affected no rows 
    2015-08-06 16:54:17,481 DEBUG AuditDSGenerator [builtinApplication.creaLotto] AUDIT_JF_MOVIMENTI is an audit DataSource, processing 
    2015-08-06 16:54:17,481 DEBUG PoolableDataSourceFactory [builtinApplication.creaLotto] Created DataSource 5220 of type 'JF_MOVIMENTI' and assigned it to thread http-bio-8444-exec-9 
    2015-08-06 16:54:17,482 DEBUG PoolableDataSourceFactory [builtinApplication.creaLotto] Created DataSource 5221 of type 'AUDIT_JF_MOVIMENTI' and assigned it to thread http-bio-8444-exec-9 
    2015-08-06 16:54:17,482 DEBUG PoolableDataSourceFactory [builtinApplication.creaLotto] Created DataSource 5221 of type 'AUDIT_JF_MOVIMENTI' and assigned it to thread http-bio-8444-exec-9 
    2015-08-06 16:54:17,482 WARN  DataSource [builtinApplication.creaLotto] When saving the audit record, getDataMap() returned null for DataSource JF_MOVIMENTI 
    2015-08-06 16:54:17,482 INFO  SQLDataSource [builtinApplication.creaLotto, builtinApplication.null] Performing add operation with
    	criteria: {AUDIT_MODIFIER:"cbosticco",AUDIT_OPERATIONTYPE:"update",AUDIT_CHANGETIME:new Date(1438872857482)}	values: {AUDIT_MODIFIER:"cbosticco",AUDIT_OPERATIONTYPE:"update",AUDIT_CHANGETIME:new Date(1438872857482)} 
    2015-08-06 16:54:17,483 DEBUG SQLValuesClause [builtinApplication.creaLotto, builtinApplication.null] Sequences: {ID_REC=SEQUENCE_ID_REC, AUDIT_REVISION=AUDIT_JF_MOVIM_AUDIT_REVISION} 
    2015-08-06 16:54:17,483 DEBUG SQLDriver [builtinApplication.creaLotto, builtinApplication.null] About to execute SQL update in 'dbJpcEP' using connection'1186605796' 
    2015-08-06 16:54:17,483 INFO  SQLDriver [builtinApplication.creaLotto, builtinApplication.null] Executing SQL update on 'dbJpcEP': INSERT INTO DBSALES.AUDIT_JF_MOVIMENTI (AUDIT_CHANGETIME, AUDIT_MODIFIER, AUDIT_OPERATIONTYPE, ID_REC, AUDIT_REVISION) VALUES (TO_DATE('2015-08-06 16:54:17','YYYY-MM-DD HH24:MI:SS'), 'cbosticco', 'update', DBSALES.SEQUENCE_ID_REC.NextVal, DBSALES.AUDIT_JF_MOVIM_AUDIT_REVISION.NextVal)

    Also, on the same table, I'm doing multiple inserts with a single dsRequest.execute(), like this:
    Code:
                List<Map> records = ...;
    ....
                    DSRequest addRecords = new DSRequest("JF_MOVIMENTI", DataSource.OP_ADD, rpcManager);
                    addRecords.setValues(records);
                    dsResponses.add(addRecords.execute());
    and I've noticed that only one record is inserted in the audit table.

    Are those ways of inserting/updating multiple records supported by the audit feature, or I have to make a dsRequest.execute for each record?

    #2
    Confirmed, allowMultiUpdate is not currently supported by the audit subsystem. These operations are most commonly used in administrative / developer interfaces so we didn't cover them. We'll make a note of this in the docs.

    Comment


      #3
      ok, thanks. Actually for my use case of multi-update the audit isn't really necessary.
      Is it possible to disable the audit feature for single operationIds or server-initiated DSRequests?

      Comment


        #4
        There's not currently a flag for that. A workaround would be a second DataSource targetting the same table with auditing not enabled - you could use inheritsFrom to avoid duplicate field definitions. But we'll look at adding the ability to skip certain operations for auditing, as a 10.1 feature.

        Comment


          #5
          ok, thank you very much.

          Comment


            #6
            This is added in 10.1 and is included in nightly builds since October 31.

            Auditing process can be skipped by setting operationBinding.skipAudit=true or by using server-side API DSRequest.setSkipAudit(boolean), see docs for details.

            Comment

            Working...
            X