NCBI C++ ToolKit
ns_db_dump.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef NETSCHEDULE_DB_DUMP__HPP
2 #define NETSCHEDULE_DB_DUMP__HPP
3 
4 /* $Id: ns_db_dump.hpp 93717 2021-05-14 17:29:38Z satskyse $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Sergey Satskiy
30  *
31  * File Description:
32  * NetSchedule database dumping support.
33  *
34  */
35 
36 #include "ns_types.hpp"
37 
38 #include <corelib/ncbitype.h>
39 
40 #include <stdio.h>
41 
42 
43 // NB
44 // The dump format is extendable and the extensions will work in both
45 // directions: forward and backward. The only requirement to keep it working is
46 // to extend the structures at the end without touching the existing part.
47 // In this case:
48 // - if a newer format is provided the older format dump (new NS starts after
49 // old NS saved the data) then: the extended fields will have zeroes.
50 // - if an older format is provided the newer data (old NS starts after a new
51 // NS, e.g. due to a rollback) then: the extended values are stripped.
52 
53 
54 
56 
57 
58 // Common header for the dump files
59 #pragma pack(push, 1)
61 {
66 
70 
72 };
73 #pragma pack(pop)
74 
75 
76 // The header appears ones in the job info file
77 #pragma pack(push, 1)
79 {
84 
86 
87  void Write(FILE * f);
88  int Read(FILE * f);
89 };
90 #pragma pack(pop)
91 
92 
93 // A few dump files store a sequence of one structure. They will use the header
94 // below
95 #pragma pack(push, 1)
97 {
100 
102 
103  void Write(FILE * f);
104  int Read(FILE * f);
105 };
106 #pragma pack(pop)
107 
108 
109 // The structures mostly match the Berkeley DB tables structure
110 // but use only fixed size POD fields
111 
112 // It is supposed that the progress message follows each instance of the
113 // structure below. The progress message is the largest (and rare used) field
114 // in the structure and it affects the dumping performance and disk usage.
115 #pragma pack(push, 1)
116 struct SJobDump
117 {
120 
123  double timeout;
124  double run_timeout;
125  double read_timeout;
126 
129 
136 
139 
142 
144 
145  double last_touch;
148 
155 
156  SJobDump();
157 
158  void Write(FILE * f, const char * progress_msg);
159  int Read(FILE * f, size_t fixed_size_from_header,
160  char * progress_msg);
161 };
162 #pragma pack(pop)
163 
164 
165 // It is supposed that the input and/or output follow each instance of the
166 // structure below. The limit of the input/output is too large to have
167 // it as a member of this structure
168 #pragma pack(push, 1)
170 {
174 
175  SJobIODump();
176 
177  void Write(FILE * f, const char * input, const char * output);
178  int Read(FILE * f, size_t fixed_size_from_header,
179  char * input, char * output);
180 };
181 #pragma pack(pop)
182 
183 
184 // It is supposed that the client_node, client_session and err_msg follow
185 // each instance of the structure below. There are a lot of the job events
186 // and otherwise it leads to both dumping speed and disk usage problems.
187 #pragma pack(push, 1)
189 {
193  double timestamp;
199 
200  SJobEventsDump();
201 
202  void Write(FILE * f, const char * client_node,
203  const char * client_session,
204  const char * err_msg);
205  int Read(FILE * f, size_t fixed_size_from_header,
206  char * client_node,
207  char * client_session,
208  char * err_msg);
209 };
210 #pragma pack(pop)
211 
212 
213 #pragma pack(push, 1)
215 {
220 
222 
223  void Write(FILE * f);
224  int Read(FILE * f, size_t fixed_size_from_header);
225 };
226 #pragma pack(pop)
227 
228 
229 #pragma pack(push, 1)
231 {
236 
237  SGroupDictDump();
238 
239  void Write(FILE * f);
240  int Read(FILE * f, size_t fixed_size_from_header);
241 };
242 #pragma pack(pop)
243 
244 
245 #pragma pack(push, 1)
247 {
249  bool is_queue;
254  double timeout;
263  double run_timeout;
264  double read_timeout;
297 
302 
304 
306 
307  void Write(FILE * f);
308  int Read(FILE * f, size_t fixed_size_from_header);
309 };
310 #pragma pack(pop)
311 
312 
313 #pragma pack(push, 1)
315 {
323 
325 
326  void Write(FILE * f);
327  int Read(FILE * f, size_t fixed_size_from_header);
328 };
329 #pragma pack(pop)
330 
331 
333 
334 #endif /* NETSCHEDULE_DB_DUMP__HPP */
static SQLCHAR output[256]
Definition: print.c:5
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static int input()
Defines Limits for the types used in NCBI C/C++ toolkit.
const unsigned int kNetScheduleMaxDBDataSize
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
const unsigned kMaxHitIdSize
Definition: ns_types.hpp:109
const unsigned kLinkedSectionsList
Definition: ns_types.hpp:114
const unsigned kLinkedSectionValueSize
Definition: ns_types.hpp:113
const unsigned kLinkedSectionValueNameSize
Definition: ns_types.hpp:112
const unsigned kMaxSessionIdSize
Definition: ns_types.hpp:111
const unsigned kMaxDescriptionSize
Definition: ns_types.hpp:116
const unsigned kMaxClientIpSize
Definition: ns_types.hpp:110
const unsigned kMaxQueueLimitsSize
Definition: ns_types.hpp:115
const unsigned kMaxQueueNameSize
Definition: ns_types.hpp:108
void Write(FILE *f)
Definition: ns_db_dump.cpp:517
int Read(FILE *f, size_t fixed_size_from_header)
Definition: ns_db_dump.cpp:526
char token[kNetScheduleMaxDBDataSize]
Definition: ns_db_dump.hpp:219
int Read(FILE *f, size_t fixed_size_from_header)
Definition: ns_db_dump.cpp:577
void Write(FILE *f)
Definition: ns_db_dump.cpp:568
char token[kNetScheduleMaxDBDataSize]
Definition: ns_db_dump.hpp:235
int Read(FILE *f)
Definition: ns_db_dump.cpp:80
Uint4 job_event_fixed_size
Definition: ns_db_dump.hpp:83
Uint4 job_props_fixed_size
Definition: ns_db_dump.hpp:81
Uint4 job_io_fixed_size
Definition: ns_db_dump.hpp:82
SCommonDumpHeader common_header
Definition: ns_db_dump.hpp:80
void Write(FILE *f)
Definition: ns_db_dump.cpp:72
void Write(FILE *f, const char *progress_msg)
Definition: ns_db_dump.cpp:153
Uint4 run_counter
Definition: ns_db_dump.hpp:137
bool need_lsnr_progress_msg_notif
Definition: ns_db_dump.hpp:134
Uint4 listener_notif_addr
Definition: ns_db_dump.hpp:130
Uint4 mask
Definition: ns_db_dump.hpp:141
double last_touch
Definition: ns_db_dump.hpp:145
double run_timeout
Definition: ns_db_dump.hpp:124
Uint4 subm_notif_port
Definition: ns_db_dump.hpp:127
Uint4 client_sid_size
Definition: ns_db_dump.hpp:150
double read_timeout
Definition: ns_db_dump.hpp:125
Uint4 passport
Definition: ns_db_dump.hpp:121
bool need_subm_progress_msg_notif
Definition: ns_db_dump.hpp:133
Uint4 progress_msg_size
Definition: ns_db_dump.hpp:146
Uint4 aff_id
Definition: ns_db_dump.hpp:140
double subm_notif_timeout
Definition: ns_db_dump.hpp:128
double timeout
Definition: ns_db_dump.hpp:123
char client_sid[kMaxSessionIdSize]
Definition: ns_db_dump.hpp:153
double listener_notif_abstime
Definition: ns_db_dump.hpp:132
Uint4 client_ip_size
Definition: ns_db_dump.hpp:149
Uint4 total_size
Definition: ns_db_dump.hpp:118
int Read(FILE *f, size_t fixed_size_from_header, char *progress_msg)
Definition: ns_db_dump.cpp:168
Uint4 read_counter
Definition: ns_db_dump.hpp:138
Uint4 id
Definition: ns_db_dump.hpp:119
Uint4 number_of_events
Definition: ns_db_dump.hpp:147
char client_ip[kMaxClientIpSize]
Definition: ns_db_dump.hpp:152
Uint4 listener_notif_port
Definition: ns_db_dump.hpp:131
Uint4 ncbi_phid_size
Definition: ns_db_dump.hpp:151
Uint4 group_id
Definition: ns_db_dump.hpp:143
bool need_stolen_notif
Definition: ns_db_dump.hpp:135
char ncbi_phid[kMaxHitIdSize]
Definition: ns_db_dump.hpp:154
Int4 status
Definition: ns_db_dump.hpp:122
void Write(FILE *f, const char *client_node, const char *client_session, const char *err_msg)
Definition: ns_db_dump.cpp:376
Uint4 client_session_size
Definition: ns_db_dump.hpp:197
int Read(FILE *f, size_t fixed_size_from_header, char *client_node, char *client_session, char *err_msg)
Definition: ns_db_dump.cpp:404
Uint4 client_node_size
Definition: ns_db_dump.hpp:196
Uint4 total_size
Definition: ns_db_dump.hpp:171
int Read(FILE *f, size_t fixed_size_from_header, char *input, char *output)
Definition: ns_db_dump.cpp:291
Uint4 output_size
Definition: ns_db_dump.hpp:173
Uint4 input_size
Definition: ns_db_dump.hpp:172
void Write(FILE *f, const char *input, const char *output)
Definition: ns_db_dump.cpp:268
char section[kLinkedSectionValueNameSize]
Definition: ns_db_dump.hpp:320
char value_name[kLinkedSectionValueNameSize]
Definition: ns_db_dump.hpp:321
char value[kLinkedSectionValueSize]
Definition: ns_db_dump.hpp:322
int Read(FILE *f, size_t fixed_size_from_header)
Definition: ns_db_dump.cpp:702
void Write(FILE *f)
Definition: ns_db_dump.cpp:694
SCommonDumpHeader common_header
Definition: ns_db_dump.hpp:98
void Write(FILE *f)
Definition: ns_db_dump.cpp:113
Uint4 client_registry_min_worker_nodes
Definition: ns_db_dump.hpp:288
char reader_hosts[kMaxQueueLimitsSize]
Definition: ns_db_dump.hpp:278
int Read(FILE *f, size_t fixed_size_from_header)
Definition: ns_db_dump.cpp:628
char qclass[kMaxQueueNameSize]
Definition: ns_db_dump.hpp:253
double client_registry_timeout_admin
Definition: ns_db_dump.hpp:289
double client_registry_timeout_unknown
Definition: ns_db_dump.hpp:295
char subm_hosts[kMaxQueueLimitsSize]
Definition: ns_db_dump.hpp:274
double client_registry_timeout_submitter
Definition: ns_db_dump.hpp:291
char linked_section_prefixes[kLinkedSectionsList]
Definition: ns_db_dump.hpp:299
Uint4 client_registry_min_unknowns
Definition: ns_db_dump.hpp:296
double client_registry_timeout_reader
Definition: ns_db_dump.hpp:293
char wnode_hosts[kMaxQueueLimitsSize]
Definition: ns_db_dump.hpp:276
char linked_section_names[kLinkedSectionsList]
Definition: ns_db_dump.hpp:301
Uint4 client_registry_min_submitters
Definition: ns_db_dump.hpp:292
void Write(FILE *f)
Definition: ns_db_dump.cpp:619
double max_pending_read_wait_timeout
Definition: ns_db_dump.hpp:283
double client_registry_timeout_worker_node
Definition: ns_db_dump.hpp:287
char qname[kMaxQueueNameSize]
Definition: ns_db_dump.hpp:251
char program_name[kMaxQueueLimitsSize]
Definition: ns_db_dump.hpp:266
char description[kMaxDescriptionSize]
Definition: ns_db_dump.hpp:285
Uint4 linked_section_prefixes_size
Definition: ns_db_dump.hpp:298
Modified on Wed Sep 04 15:03:38 2024 by modify_doxy.py rev. 669887