SVN

The whole model (all diagrams) are currently stored in my private svn here.

FileTransferDB

The current database schema is here. The new db schema:

A FTS request is defined as:

  • list of LFNs,
  • targetSE (could be a list of targetSEs),
  • timeout condition (deadline or interval of validity),
  • catalogue for replica registration.

Average number of files in one FTS request is about 10:

mysql> select avg(c),stddev(c) from ( select count(FTSReqID) as c from FileToFTS group by FTSReqID ) a ; 
+--------+-----------+
| avg(c) | stddev(c) |
+--------+-----------+
| 9.5519 |   21.2040 |
+--------+-----------+
but real number varies from 1 to more than 100.

Pointing hand db probably not completed.

  • What about keeping all information about particular file (or FTS transfer) history in one table?
  • All information could be kept in 4-5 tables instead of 10 (not including Requests and SubRerquests, which are going to separate db anyway).

ver 1 (lost in space)

ver 2

FileTransferDB.Schema.png

ver 3

FileTransferDB.Schema.3.png

ver 4

FileTransferDB.Schema.4.png

Removed status New, setting Scheduling as default.

Missing table for transfers.

ver 5

FileTransferDB.Schema.5.png

TODO: add OwnerDN and GroupDN into Tranfser.

Classes and inheritance

FTSClassesInheritance.png

IDEA! For brevity only public methods are shown.

Question What about introducing an object made of FTSRequest and related LFNS, PFNS, Channel and ReplicationTree records (a la ORM)?:

  • Plus
    • db interface would be light
    • during one transaction (session) records would be locked (thread safe?), so it will be a real state machine
    • full encapsulation
  • Minus
    • on the other hand FTSRequest object would be heavy, but it would be used only internally (inner class) in FileTransferDB

Also there is a possibility to introducing cascade of objects, retrieved on demand, e.g.:

  • first select =FTSRequest=s with some status, say New, (or whatever else selection criteria)
  • then, if required by processing attach to them on demand list of FTSLFNs and/or list of FTSPFNs with some selection criteria

State machines

All processing should be (exclusively) done in new python module interacting with db itself.

  • this module should be inherited from DIRAC.Core.Utilities.MySQL class
  • in above model agents would be used rather to trigger some actions depending of the FTS state
  • state transitions would be done in DB module itself (no excuses! no exceptions!)

Possible way of enforcing integrity is "passing a token" between agents and db: python object built up from FileTransferDB.FTSRequest, FileTransferDB.FTSFIles and FileTransferDB.ReplicationTree. This could be a client (in sense of DIRAC) and ORM in sense of db.

FileTransferDB.PFNS.Status:

FileTransferDB.PFNS.Status.png

FileTransferDB.FTSRequest.Status:

ver 1

FileTransferDB.FTSRequest.Status.png

The first version, raw and outdated.

ver 2

FileTransferDB.FTSRequest.Status-NEW.png

Comments

Obviously too complicated:

  • put new table for spotted errors (i.e. Alarms, name it if you have a better idea) with content:
    1table Alarms (
    2    AlarmID (PK)
    3    FTSReqID (FK)
    4    Timestamp (datetime)
    5    AlarmType (enum 'SchedulingError', 'SubmitError', 'TransferError', 'RegistrationError', 'Fatal'  what else?),
    6    AlarmInfo (varchar could be a tarceback, or some description, reason of raising etc.)
    7);
    8   
  • store only the latest alarm raised in FTSRequest as FK
  • remove 'SchedulingError', 'SubmitError', 'TransferError' and 'RegistrationError' from states and add 'Fatal' for some definitive-100%-lethal-and-completely-unrecoverable failure (like some vital service not running etc.).

In that way state machine would be much easier too implement:

  • agents will pick up only requests within certain state,
  • they will change the state of request only if no errors would be spotted during processing,
  • on error conditions they will raise alarm, which will go to the Alarms table, but state of request would remain unchanged - just keep trying redo your job until time out, unless of course some "definitive-100%-lethal-and-completely-unrecoverable failure" - whatever it is (we should meet together and discuss some day about that).

Also please notice it will be rather easy reset FTSRequest on time out condition: you have to change it state to New and extend its deadline. So if system will be dead for a while we have simple recovery solution. At least on R&D stage. wink

ver 3

Simplicity is the ultimate form of sophistication.

FileTransferDB.FTSRequest.Status-LATEST.png

Comments

No need to keep New state, of course all new request undergo scheduling eventually, so we could start from Scheduling, right?

ver 4

Simplicity is the ultimate form of sophistication (again!)

FileTransferDB.FTSRequest.Status.4.png

Comments

  • what if file is already there? Or is being transferred in other request? (could be marked as 'Done' in FTSScheduler.execute, for being transferred situation seems to be more complicated)
  • re-scheduling should come out from schedule, submit or transfer (or from all???)

Token passing

DB structure

  • encapsulation each table in DB has to have its own class describing it with full API for manipulating records
  • state machine each above class should behave like a state machine
  • foreign keys if any exists in table, should be retrieved on demand from within object that has it

-- KrzysztofCiba - 01-Apr-2011

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng FTSClassesInheritance.png r3 r2 r1 manage 76.8 K 2011-03-29 - 14:10 KrzysztofCiba  
PNGpng FTSDatabase.png r2 r1 manage 88.5 K 2011-03-28 - 10:55 KrzysztofCiba  
PNGpng FTS_StateMachine.png r5 r4 r3 r2 r1 manage 63.0 K 2011-03-28 - 16:17 KrzysztofCiba  
PNGpng FileTransferDB.FTSFiles.Status.png r2 r1 manage 63.8 K 2011-03-28 - 16:53 KrzysztofCiba  
PNGpng FileTransferDB.FTSRequest.Status-LATEST.png r1 manage 45.5 K 2011-03-31 - 15:31 KrzysztofCiba  
PNGpng FileTransferDB.FTSRequest.Status-NEW.png r2 r1 manage 105.1 K 2011-03-31 - 12:43 KrzysztofCiba  
PNGpng FileTransferDB.FTSRequest.Status.4.png r1 manage 40.6 K 2011-04-01 - 12:49 KrzysztofCiba  
PNGpng FileTransferDB.FTSRequest.Status.png r3 r2 r1 manage 51.4 K 2011-03-29 - 16:19 KrzysztofCiba  
PNGpng FileTransferDB.PFNS.Status.png r1 manage 51.0 K 2011-03-30 - 15:47 KrzysztofCiba  
PNGpng FileTransferDB.Schema.3.png r1 manage 142.2 K 2011-03-31 - 16:04 KrzysztofCiba  
PNGpng FileTransferDB.Schema.4.png r1 manage 141.8 K 2011-04-01 - 12:50 KrzysztofCiba  
PNGpng FileTransferDB.Schema.5.png r2 r1 manage 132.3 K 2011-04-12 - 16:04 KrzysztofCiba  
PNGpng FileTransferDB.Schema.png r7 r6 r5 r4 r3 manage 130.9 K 2011-03-30 - 16:04 KrzysztofCiba  
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r18 - 2011-04-19 - KrzysztofCiba
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback