CN114691732A - Method and device for positioning abnormal transaction, nonvolatile storage medium and processor - Google Patents
Method and device for positioning abnormal transaction, nonvolatile storage medium and processor Download PDFInfo
- Publication number
- CN114691732A CN114691732A CN202210234282.6A CN202210234282A CN114691732A CN 114691732 A CN114691732 A CN 114691732A CN 202210234282 A CN202210234282 A CN 202210234282A CN 114691732 A CN114691732 A CN 114691732A
- Authority
- CN
- China
- Prior art keywords
- transaction
- serial number
- abnormal
- calling
- current
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000002159 abnormal effect Effects 0.000 title claims abstract description 260
- 238000000034 method Methods 0.000 title claims abstract description 85
- 239000003999 initiator Substances 0.000 claims abstract description 77
- 230000008569 process Effects 0.000 claims description 32
- 230000001174 ascending effect Effects 0.000 claims description 26
- 238000004458 analytical method Methods 0.000 claims description 22
- 238000012545 processing Methods 0.000 claims description 16
- 230000002547 anomalous effect Effects 0.000 claims description 10
- 230000005856 abnormality Effects 0.000 claims description 7
- 238000005516 engineering process Methods 0.000 abstract description 13
- 238000010586 diagram Methods 0.000 description 18
- 238000004590 computer program Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 7
- 238000011144 upstream manufacturing Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000000977 initiatory effect Effects 0.000 description 2
- 238000002955 isolation Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000000630 rising effect Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 241000533950 Leucojum Species 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000003203 everyday effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
- G06F16/90344—Query processing by using string matching techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method and a device for positioning abnormal transactions, a nonvolatile storage medium and a processor. The invention comprises the following steps: under the condition that abnormal transactions exist in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transactions; and positioning the abnormal transaction according to the target serial number, determining the information of the abnormal transaction and a corresponding calling system when the abnormal transaction occurs, wherein the calling system comprises an initiator system and a called system for transaction calling. According to the method, the target serial number of the abnormal transaction is acquired to have uniqueness, one transaction can be uniquely positioned, and each system called by the transaction link can be described, so that the information of the abnormal transaction and the calling system when the abnormal transaction occurs can be positioned according to the target serial number, the abnormal system can be positioned according to the target serial number, and the technical problem that the abnormal system is difficult to position under the condition that the transaction is abnormal in the related technology is solved.
Description
Technical Field
The invention relates to the field of computers, in particular to a method and a device for positioning abnormal transactions, a nonvolatile storage medium and a processor.
Background
At present, the business of banks is various and rich in business scenes, thousands of transactions can be processed every day, one transaction often involves a plurality of systems, when the transaction is abnormal, firstly, the abnormal transaction needs to be positioned, and secondly, the process of calling the system where the abnormality occurs in the transaction needs to be known, so that the transaction positioning and transaction link tracking are particularly important in bank transactions.
In the existing banking business, serial numbers are generally used for recording and tracking a transaction, the current technology can generate globally unique serial numbers, and the current mature scheme is snowflake algorithm. This scheme is an algorithm for generating IDs by partitioning the namespace, which uses binary representation, with 64-bits, divided into segments, and divided to indicate machine, time, etc. The first part of the method is 1-bit and represents a sign bit; the second part is 41-bit used for recording a time stamp, and the millisecond level can represent 69 years of time; the third part is 10-bit representing machine id used for recording the number of the working machine; the fourth part is 12-bit indicating the sequence number, which is used to record the different id generated in the same millisecond.
Although serial numbers can uniquely locate a transaction, it lacks a specific description of the system involved in the transaction, and once an abnormality occurs in the transaction, it is difficult for the operation and maintenance personnel to locate the abnormal system only according to the serial numbers.
In addition, for the existing codes capable of describing transaction link information, only simple system call relations can be described, such as "a- > B- > C", while many transactions in banking services involve complicated links, the call relations often have multiple sub-branches, and an accurate and clear coding mode is still needed for expressing the link structures.
Aiming at the problem that the abnormal system is difficult to locate under the condition that the transaction serial number in the related technology is abnormal, an effective solution is not provided at present.
Disclosure of Invention
The invention mainly aims to provide a method and a device for positioning abnormal transactions, a nonvolatile storage medium and a processor, so as to solve the problem that a transaction serial number in the related art is difficult to position to a system with abnormal transactions under the condition of abnormal transactions.
To achieve the above object, according to one aspect of the present invention, there is provided a method of locating an abnormal transaction. The invention comprises the following steps: under the condition that abnormal transactions exist in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transactions; and positioning the abnormal transaction according to the target serial number to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, wherein the calling system comprises a transaction calling initiator system.
Further, when it is detected that an abnormal transaction exists in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transaction, including: under the condition that abnormal transactions exist in a plurality of transactions, acquiring a current message generated in the transaction process of the abnormal transactions; and acquiring the target serial number contained in the message, wherein the target serial number comprises a global service tracking number corresponding to the abnormal transaction and a sub-transaction serial number corresponding to the abnormal transaction, and the global service tracking number runs through the whole transaction process corresponding to the abnormal transaction.
Further, positioning the abnormal transaction according to the target serial number to determine the information of the abnormal transaction, including: analyzing the global service tracking number and obtaining a first analysis result, wherein the first analysis result at least comprises a timestamp, a first system number, a first transaction instance serial number and a serial number, the timestamp is the timestamp corresponding to the abnormal transaction when the transaction is initiated, the first system number is an identification code corresponding to an original initiator system of the abnormal transaction, the first transaction instance serial number is the identification code of a machine where the transaction instance corresponding to the abnormal transaction is located, and the serial number is a circularly-increased serial number generated by the original initiator system when the abnormal transaction is initiated; and determining the information of the abnormal transaction according to the first analysis result.
Further, before locating the abnormal transaction according to the target serial number to determine the information of the abnormal transaction, the method further includes: acquiring an MAC address corresponding to a machine where an original transaction instance corresponding to the abnormal transaction is located; calculating a hash value corresponding to the MAC address, and performing a modulus operation on the hash value to obtain a modulus result; and carrying out zero filling operation on the modulus result to obtain the first transaction instance serial number.
Further, positioning the abnormal transaction according to the target serial number to determine a corresponding calling system when the abnormal transaction is abnormal in a transaction link, comprising: acquiring a target sub-transaction serial number contained in the target serial number, wherein the target sub-transaction serial number is a current sub-transaction serial number generated in the transaction process of the abnormal transaction; analyzing the target sub-transaction serial number and obtaining a second analysis result, wherein the second analysis result at least comprises a second system number, a second transaction instance serial number and a latest transaction arrangement number, the second system number is an identification code corresponding to the current calling initiator system corresponding to the abnormal transaction, the second transaction instance serial number is an identification code of a machine where the transaction instance corresponding to the current calling initiator system is located, and the latest transaction arrangement number represents a call link to the system in the current calling process from two dimensions, namely a horizontal dimension and a longitudinal dimension; and determining a corresponding calling system when the abnormal transaction is abnormal in the transaction link according to the second analysis result.
Further, before the abnormal transaction is located according to the target serial number to determine a corresponding calling system when the abnormal transaction is abnormal in a transaction link, the method comprises the following steps: acquiring current system call information corresponding to the abnormal transaction in the transaction link, wherein the current system call information at least comprises information of the current call initiator system corresponding to the abnormal transaction and information of the current called system; and generating the target sub-transaction serial number according to the current system calling information.
Further, generating the target sub-transaction serial number according to the current system call information includes: acquiring an identification code corresponding to the current calling initiator system, and determining the identification code as a prefix of the target sub-transaction serial number; determining the level of the transaction link where the current system is located, and determining a number corresponding to the level of the transaction link; arranging the prefixes and the numbers in sequence, and determining characters except the prefixes and the hierarchy numbers to be 0 so as to generate a reference serial number corresponding to the target sub-transaction serial number; acquiring the calling condition of the current calling initiator system for calling the current called system, and adjusting the reference serial number according to the calling condition; and determining the adjusted reference serial number as the target sub-transaction serial number.
Further, obtaining a calling condition that the current calling initiator system calls the current called system, and adjusting the reference sequence number according to the calling condition includes: judging whether the current calling initiator system is an external system for the first calling when the current called system is called by the current calling initiator system; under the condition that the current calling initiator system calls the external system for the first time, performing layer-ascending processing on the reference serial number to convert a character with a first bit of 0 in the reference serial number into 1; and under the condition that the current calling initiator system does not call the external system for the first time, performing ascending processing on the reference sequence number to adjust the level number in the reference sequence number to be added with 1.
To achieve the above object, according to another aspect of the present invention, there is provided an apparatus for locating an abnormal transaction. The device includes: the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target serial number corresponding to an abnormal transaction when the abnormal transaction is detected in a plurality of transactions; and the positioning unit is used for positioning the abnormal transaction according to the target serial number so as to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, wherein the calling system comprises a transaction calling initiator system.
In order to achieve the above object, according to still another aspect of the present invention, there is provided a nonvolatile storage medium including a stored program, wherein a device in which the nonvolatile storage medium is located is controlled to perform any one of the methods when the program is executed.
To achieve the above object, according to a further aspect of the present invention, there is provided a processor for executing a program, wherein the program executes to perform any one of the methods.
According to the invention, firstly, under the condition that abnormal transactions exist in a plurality of transactions, a target serial number corresponding to the abnormal transactions is obtained, then, the abnormal transactions are positioned according to the target serial number, the information of the abnormal transactions and a calling system corresponding to the abnormal transactions are determined, and the calling system comprises an initiator system for transaction calling and a called system. According to the method, the target serial number of the abnormal transaction is acquired to have uniqueness, one transaction can be uniquely positioned, and each system called by the transaction link can be described, so that the information of the abnormal transaction and the calling system when the abnormal transaction occurs can be positioned according to the target serial number, the abnormal system can be positioned according to the target serial number, and the technical problem that the abnormal system is difficult to position under the condition that the transaction is abnormal in the related technology is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow chart of a method for locating anomalous transactions provided in accordance with an embodiment of the present invention;
FIG. 2 is a schematic diagram of an apparatus for locating anomalous transactions provided in accordance with an embodiment of the present invention;
FIG. 3 is a flow diagram providing transaction instance sequence number generation according to an embodiment of the present invention;
FIG. 4 is a flow diagram providing sequence number generation according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a transaction link provided in accordance with an embodiment of the present invention;
FIG. 6 is a flow diagram of transaction instance sequence number generation provided in accordance with an embodiment of the present invention;
FIG. 7 is a schematic diagram of a transaction link provided in accordance with an embodiment of the present invention;
FIG. 8 is a flow diagram of a layer promotion logic provided in accordance with an embodiment of the present invention;
FIG. 9 is a flow diagram of upgrade logic provided according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged under appropriate circumstances in order to facilitate the description of the embodiments of the invention herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
As mentioned in the background, in the related art, in the event of an abnormal transaction, it is difficult to locate the system where the abnormal transaction occurs, and in order to solve the above problem, in an exemplary embodiment of the present application, a method, an apparatus, a non-volatile storage medium and a processor for locating the abnormal transaction are provided.
According to an embodiment of the invention, a method of locating anomalous transactions is provided.
FIG. 1 is a flow diagram of a method of locating anomalous transactions in accordance with an embodiment of the present invention. As shown in fig. 1, the present invention comprises the steps of:
step S101, under the condition that abnormal transactions exist in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transactions;
and step S102, positioning the abnormal transaction according to the target serial number to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, wherein the calling system comprises a transaction calling initiator system.
In the method, firstly, under the condition that abnormal transactions exist in a plurality of transactions, a target serial number corresponding to the abnormal transactions is obtained, then, the abnormal transactions are positioned according to the target serial number, information of the abnormal transactions and a corresponding calling system when the abnormal transactions occur are determined, and the calling system comprises an initiator system for transaction calling and a called system. According to the method, the target serial number of the abnormal transaction is acquired to have uniqueness, one transaction can be uniquely positioned, and each system called by the transaction link can be described, so that the information of the abnormal transaction and the calling system when the abnormal transaction occurs can be positioned according to the target serial number, the abnormal system can be positioned according to the target serial number, and the technical problem that the abnormal system is difficult to position under the condition that the transaction is abnormal in the related technology is solved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
In an embodiment of the present application, when it is detected that an abnormal transaction exists in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transaction includes: under the condition that abnormal transactions exist in a plurality of transactions, acquiring a current message generated in the transaction process of the abnormal transactions; and acquiring the target serial number contained in the message, wherein the target serial number comprises a global service tracking number corresponding to the abnormal transaction and a sub-transaction serial number corresponding to the abnormal transaction, and the global service tracking number runs through the whole transaction process corresponding to the abnormal transaction. When cross-system calling is carried out, a standard public message is used for recording key fields required by transaction, and a target serial number belongs to the key fields required to be recorded, so that the target serial number can be obtained from the current message, and comprises a global service tracking number and a sub-transaction serial number which run through the whole transaction process of the abnormal transaction.
In order to obtain accurate information of abnormal transactions, in another embodiment of the present application, the locating the abnormal transaction according to the target serial number to determine the information of the abnormal transaction includes: analyzing the global service tracking number and obtaining a first analysis result, wherein the first analysis result at least comprises a timestamp, a first system number, a first transaction instance serial number and a serial number, the timestamp is the timestamp corresponding to the abnormal transaction when the transaction is initiated, the first system number is an identification code corresponding to an original initiator system of the abnormal transaction, the first transaction instance serial number is the identification code of a machine where the transaction instance corresponding to the abnormal transaction is located, and the serial number is a circularly-increased serial number generated for the original initiator system when the abnormal transaction is initiated; and determining the information of the abnormal transaction according to the first analysis result. The global service tracking number is generated by the trigger point, and the consistency lasts until the time is completely finished, so that the information of the abnormal transaction is recorded in the global service tracking number.
The global service tracking number may be used as a database primary key in the system, the length of the primary key is required to be not too long for the primary key of the database, and in addition, considering that the global service tracking number has more components, in a specific embodiment of the present application, the global service tracking number is set to be 32 bits. The composition of the global service tracking number is shown in table one:
watch 1
The time stamp is as follows: generated by acquiring the local system time, belongs to the technical field.
The system number is as follows: all systems are organized according to the division of business functions, which is a code with business attributes, which is composed of 7 bits, which is derived from a unified standard. For example, the deposit system uses "1111111" and the money transfer system uses "2222222". The system number in the usage, global traffic tracking number is generated by the transaction initiator.
Transaction instance number above: this component belongs to the technology field. The generation flow is as shown in fig. 3, when the transaction instance serial number is initiated to be acquired, the transaction instance serial number is acquired from a local environment variable, the environment variable is an environment parameter configured in the server, if the environment variable exists, the environment variable is directly returned, if the environment variable does not exist, the environment variable is acquired from a starting parameter of the system, if the environment variable exists, the configuration of the transaction instance serial number is directly returned, and if the environment variable does not exist, the transaction instance serial number is generated through a local default implementation algorithm. The transaction instance sequence number in the global transaction tracking number is generated by the transaction initiator.
The generation of the sequence number: in the present application, the serial numbers are recycled, and the flow of their generation is shown in fig. 4. The serial number is self-increased by adopting Java native AtomicInteger, whether the result obtained after self-increasing is larger than 999999 is judged, if so, the serial number is set to be 1 and the character string formatting is carried out, and if not, the obtained result is carried out the character string formatting to generate the final serial number.
And splicing the generated 14-bit timestamp, the 7-bit system code, the 5-bit initiated transaction instance serial number and the 6-bit sequence number to obtain the generated global service tracking number. As shown in FIG. 5, assume that there is a transaction, and the transaction link is shown in the following figure. The system A is used as a transaction initiator, the system A generates a global business tracking number of the transaction, and the system B and the system C can not generate the global business tracking number again. Each inter-system call in a transaction sends a global transaction tracking number to a downstream system.
In another embodiment of the present application, as shown in fig. 6, before the locating the abnormal transaction according to the target serial number to determine the information of the abnormal transaction, the method further includes: acquiring an MAC address corresponding to a machine where an original transaction instance corresponding to the abnormal transaction is located; calculating a hash value corresponding to the MAC address, and performing a modulus operation on the hash value to obtain a modulus result; and carrying out zero filling operation on the modulus result to obtain the first transaction instance serial number. In this embodiment, a hash value is calculated by using the MAC address of the machine where the original transaction instance is located, then a modulo operation is performed on the hash value, and finally a zero padding operation is performed on the result of the modulo operation, thereby obtaining an accurate serial number of the first transaction instance.
For example, if the transaction instance number is 5 bits, then 99999(5 9) is modulo, and if the transaction instance number is 6 bits, then 999999(6 9) is modulo. And finally, performing character string formatting (namely zero padding operation) on the modulus result to complete the generation of the transaction instance serial number.
In addition, the method for determining the serial number of the first transaction instance further comprises the steps of obtaining configuration parameters of service starting and obtaining environment variable configuration.
In another embodiment of the present application, the positioning the abnormal transaction according to the target serial number to determine a calling system corresponding to the abnormal transaction when an abnormality occurs in a transaction link includes: acquiring a target sub-transaction serial number in a plurality of sub-transaction serial numbers contained in the target serial number, wherein the target sub-transaction serial number is a current sub-transaction serial number generated in the transaction process of the abnormal transaction; analyzing the target sub-transaction serial number and obtaining a second analysis result, wherein the second analysis result at least comprises a second system number, a second transaction instance serial number and a latest transaction arrangement number, the second system number is an identification code corresponding to the current calling initiator system corresponding to the abnormal transaction, the second transaction instance serial number is an identification code of a machine where the transaction instance corresponding to the abnormal transaction generated by the current calling initiator system is located, and the latest transaction arrangement number represents a call link to the system in the current calling process from two dimensions, namely a horizontal dimension and a longitudinal dimension; and determining a corresponding calling system when the abnormal transaction is abnormal in the transaction link according to the second analysis result. In this embodiment, the target sub-transaction serial number needs to be first obtained to obtain a second system number, a second transaction instance serial number, and a latest transaction arrangement number, and the transaction link of the call initiation system and the call process of the abnormal transaction can be located through the second system number, the second transaction instance serial number, and the latest transaction arrangement number, so that the call system in which the abnormality occurs in the complex link can be quickly located.
The target sub-transaction serial number includes a second system number, a second transaction instance serial number, and a latest transaction arrangement number. The target sub-transaction serial number is mainly used for identifying each calling sub-branch of one transaction. The composition of the target sub-transaction sequence number is shown in table two:
watch two
The second system number is different from the system number in the global service tracking number in that the second system number is generated by the current call initiator system.
The generation method of the transaction instance serial number is consistent with the method of the global service tracking number, but the difference is that the transaction instance serial number is generated by a calling initiator system.
The latest transaction arrangement number is composed of letters and numbers. The latest transaction arrangement number has 20 bits in total, which represents that the maximum support of the transaction level number is 20 layers, and the character value range of each bit in the latest transaction arrangement number is 1-9, A-Z, which represents that the maximum support of the same-level transaction instance number is 35. The latest transaction arrangement number represents a transaction calling link from two dimensions of horizontal and vertical, and is transmitted backwards along the transaction link. The initial value of the latest transaction serial number is all 0, and the latest transaction serial number can be subjected to layer-ascending or ascending logic every time system calling occurs on a transaction link.
In yet another embodiment of the present application, before the abnormal transaction is located according to the target serial number to determine a corresponding calling system when the abnormal transaction is abnormal in a transaction link, the method includes: acquiring current system call information corresponding to the abnormal transaction in the transaction link, wherein the current system call information at least comprises information of the current call initiator system corresponding to the abnormal transaction and information of the current called system; and generating the target sub-transaction serial number according to the current system calling information. In this embodiment, the target sub-transaction serial number is generated according to the call information of the current system, so that the system with abnormal transaction can be located according to the target sub-transaction serial number, and the call system with abnormal transaction can be located more quickly.
In a specific embodiment of the present application, after receiving a message transmitted by an upstream system, an offspring transaction serial number in the message is stored in a customized context, and the customized context is implemented using a thread class native to JAVA. Thread local is a storage class inside a thread, and can store data in a specified thread, and after the data is stored, only the specified thread can obtain the stored data. Thread local has a thread isolation effect by using a single memory space for each thread, and the corresponding value can be obtained only in the thread, and the desired value cannot be accessed outside the thread. Therefore, the current thread for transaction can acquire the sub-transaction serial number transmitted from the upstream system to the system through the customized context.
And creating a data structure of the stack in the custom context, wherein the data structure is used for storing the newly generated sub-transaction serial number and is marked as a sub-transaction serial number stack. The number of the sub-transaction serial numbers stored at the beginning of the stack is 0, the sub-transaction serial numbers are pressed into the stack every time a new sub-transaction serial number is generated, and the elements at the top of the stack are the latest sub-transaction serial numbers forever. It should be noted that there are two attributes in the custom context for storing the sub-transaction serial number, and the difference between the two attributes, which are denoted as substxno and substxnotack in the present application, is shown in table three below.
Watch III
When the layer upgrading of the sub-transaction sequence numbers is needed, whether the number of elements in the sub-transaction sequence number stack subTxNOStack is 0 or not is mainly used for judging, if the number of the elements in the sub-transaction sequence number stack subTxNOStack is 0, the generation of the sub-transaction sequence numbers is not performed by the current system, and the logic of layer upgrading is performed when the current system calls the external system for the first time. When the layer is upgraded, the sub-transaction sequence number subTxNo transmitted to the system by the upstream system needs to be taken out from the custom context, the logic of the layer upgrading of the sub-transaction sequence number in the section is completed by taking the sub-transaction sequence number subTxNo as a reference, and finally the newly generated sub-transaction sequence number is pressed into a sub-transaction sequence number stack subTxNoStack of the custom context.
When the sub-transaction sequence number rises, the judgment is also carried out according to whether the number of elements in the sub-transaction sequence number stack subTxNOStack is 0, if not, the generation of the sub-transaction sequence number is shown by the current system, and the logic of rising is carried out when the current system is not the first calling external system. When the sub-transaction sequence number is increased, the sub-transaction sequence number at the top of the stack needs to be obtained from the sub-transaction sequence number stack subTxNOStack, the logic of increasing the sub-transaction sequence number in the section is completed by taking the sub-transaction sequence number as a reference, and finally, the newly generated sub-transaction sequence number is pressed into the sub-transaction sequence number stack subTxNOStack.
And when the caller system needs to generate the sub-transaction serial number, returning the stack top element of the sub-transaction serial number stack with the self-defined context to the system.
In another embodiment of the present application, the generating the target sub-transaction serial number according to the current system call information includes: acquiring an identification code corresponding to the current calling initiator system, and determining the identification code as a prefix of the target sub-transaction serial number; generating the target sub-transaction serial number to obtain a transaction instance serial number; determining the current system in the transaction link level and determining the level number corresponding to the level; arranging the prefixes and the hierarchy numbers in sequence, and determining characters except the prefixes and the hierarchy numbers to be 0 so as to generate a reference serial number corresponding to the target sub-transaction serial number; acquiring the calling condition of the current calling initiator system for calling the current called system, and adjusting the reference serial number according to the calling condition; and determining the adjusted reference serial number as the target sub-transaction serial number. In this embodiment, a prefix of the calling and originating system and a hierarchical number of the exchange are determined, then the number of characters in the target sub-transaction serial number is determined, the prefix and the hierarchical number are arranged in sequence, and the characters except the prefix and the hierarchical number are determined to be 0, so that the target sub-transaction serial number is generated.
The process for generating the target sub-transaction serial number specifically comprises the following steps: taking the transaction link shown in fig. 7 as an example, the link focuses on the generation flow of the latest transaction arrangement number, and the system number and the transaction instance number in the sub-transaction number are represented by using corresponding placeholders in a unified manner, for example, the system a uses the letter "a" to represent the system number and the transaction instance number, the system B uses the letter "B" to represent the system number and the transaction instance number, and so on.
(1) The system a generates the first sub-transaction serial number of the transaction as the transaction initiator, and the sub-transaction serial number is "a 1000000000000000000". The system A is used as a transaction initiator, the transaction level number of the system A is 1, so that the first bit in the corresponding latest transaction arrangement number is 1, and the last 19 bits are 0;
(2) system a first calls system B, then system C, and then system D.
At this time, three new sub-transaction serial numbers need to be generated to represent the three call branches, and the system number and the transaction instance serial number in the three sub-transaction serial numbers are generated by the system a, so the prefixes of the sub-transaction serial numbers are all a. For the first time, the system A calls the system B, which belongs to the external system called by the system A for the first time, so that the logic of upgrading is needed, and the sub-transaction serial number obtained by taking the first sub-transaction serial number 'A1000000000000000000' as the reference according to the logic of upgrading is 'A110000000000000'; secondly, the system A calls the system C, the non-system A calls the external system for the first time, so that the ascending logic is needed, the above one sub-transaction serial number 'A1100000000000000000' is used as a reference, and the obtained sub-transaction serial number is 'A120000000000000' according to the ascending logic; thirdly, the system A calls the system D, the non-system A calls the external system for the first time, so that the ascending logic is needed, the sub-transaction serial number is 'A13000000000000000000000' according to the ascending logic with the above one sub-transaction serial number 'A1200000000000000000' as the reference.
(3) System B calls system E and system B calls system F. At this time, two new sub-transaction serial numbers need to be generated to represent the two call sub-branches, and the system number and the transaction instance serial number in the two sub-transaction serial numbers are generated by the system B. For the first time, the system B calls the system E, which belongs to the external system called by the system B for the first time, so that the logic of ascending a layer is needed, the previous sub-transaction serial number 'A110000000000000' is taken as a reference, and the generated sub-transaction serial number is 'B111000000000000'; secondly, the system B calls the system F, the non-system B calls the external system for the first time, and therefore the ascending logic is required, and the sub-transaction serial number obtained according to the ascending logic with the previous sub-transaction serial number "B11100000000000000000000" as the reference.
(4) System D calls system G. At this time, a new sub-transaction serial number is generated to represent the call sub-branch, and the system number and the transaction instance serial number of the sub-transaction serial number are generated by the system D. The system D calls the system G, belongs to the external system called by the system D for the first time, therefore, the logic of ascending the layer is needed, the sub-transaction serial number is 'D1310000000000000000' according to the logic of ascending the layer, and the obtained sub-transaction serial number is 'A1300000000000000000'. So far, the latest transaction arrangement number generation process of the transaction link is completed.
Taking the generated target sub-transaction serial number "D1310000000000000000" as an example, it can be known that the system caller is system D; in the latest transaction arrangement number of the last 20 digits, 3 non-0 characters are totally contained, which indicates that the transaction level number of the current system in the transaction link is 3; and finding the position of the latest transaction arrangement number, in which the character 0 appears from left to right, and recording the position as pos, wherein pos is subtracted by one, and the corresponding character is '1', which indicates that the current system is the first system called by the system D.
In order to more quickly locate a system with an exception, in another embodiment of the present application, obtaining a call condition that the current call initiator system calls the current called system, and adjusting the reference serial number according to the call condition includes: judging whether the current calling initiator system is an external system for the first calling when the current called system is called by the current calling initiator system; under the condition that the current calling initiator system calls the external system for the first time, performing layer-ascending processing on the reference serial number to convert a character with a first bit of 0 in the reference serial number into 1; and in the case that the current calling initiator system does not call the external system for the first time, performing ascending processing on the reference serial number to adjust the level number in the reference serial number to be added with 1. In this embodiment, according to whether the calling initiator system calls the external system for the first time, the layer-up logic or the layer-up logic is performed, so that the calling condition of the current system can be obtained according to the first bit in the reference sequence number and the layer number.
In a specific embodiment of the present application, as shown in fig. 8, the layer-ascending logic needs to find a position where a character 0 appears first in the latest transaction serial number from left to right, if the position exists, the character 0 is modified to 1, that is, the layer-ascending logic of the latest transaction serial number is completed, and if the position does not exist, it indicates that the transaction level number has reached the maximum, and the layer cannot be continuously upgraded.
In another specific embodiment of the present application, the ascending order logic is shown in FIG. 9, which first finds the position of the first occurrence of character 0 from left to right in the latest transaction arrangement, and records the position as pos. If pos exists, acquiring a character of the pos minus 1 position, then judging whether the character is Z counting, carrying out binary operation, if so, indicating that the number of the transaction instances of the same level reaches the maximum, and if not, carrying out self increment on the character. Character incrementing requires that when the character is 9, the result after incrementing is a. If pos does not exist, the last character in the latest transaction arrangement number is obtained, then whether the character is Z or not is judged, and the following steps are consistent with the previous steps.
The embodiment of the present invention further provides a device for positioning abnormal transactions, and it should be noted that the device for positioning abnormal transactions of the embodiment of the present invention can be used to execute the method for positioning abnormal transactions provided by the embodiment of the present invention. The following describes an apparatus for locating abnormal transactions according to an embodiment of the present invention.
FIG. 2 is a schematic diagram of an apparatus for locating anomalous transactions in accordance with an embodiment of the present invention. As shown in fig. 2, the apparatus includes:
a first obtaining unit 10, configured to obtain a target serial number corresponding to an abnormal transaction when it is detected that the abnormal transaction exists in multiple transactions;
and a positioning unit 20, configured to position the abnormal transaction according to the target serial number, so as to determine information of the abnormal transaction and a calling system corresponding to the abnormal transaction when an abnormality occurs in a transaction link, where the calling system includes a transaction calling initiator system. .
The device comprises a first obtaining unit and a positioning unit, wherein the obtaining unit is used for obtaining a target serial number corresponding to the abnormal transaction when the abnormal transaction is detected in a plurality of transactions, the positioning unit is used for positioning the abnormal transaction according to the target serial number, determining information of the abnormal transaction and a corresponding calling system when the abnormal transaction occurs, and the calling system comprises an initiator system for calling the transaction and a called system. In the device, the target serial number of the abnormal transaction is acquired to have uniqueness, one transaction can be uniquely positioned, and each system called by the transaction link can be described, so that the information of the abnormal transaction and the calling system when the abnormal transaction occurs can be positioned according to the target serial number, the abnormal system can be positioned according to the target serial number, and the technical problem that the abnormal system is difficult to position under the condition that the abnormal transaction occurs in the transaction serial number in the related technology is solved.
In an embodiment of the application, the first obtaining unit includes a first obtaining subunit and a second obtaining subunit, where the first obtaining subunit is configured to, when it is detected that there is an abnormal transaction in multiple transactions, obtain a current message generated in a transaction process of the abnormal transaction; the second obtaining subunit is configured to obtain the target serial number included in the message, where the target serial number includes a global service tracking number corresponding to the abnormal transaction and a sub-transaction serial number corresponding to the abnormal transaction, and the global service tracking number runs through the whole transaction process corresponding to the abnormal transaction. When cross-system calling is carried out, a standard public message is used for recording key fields required by transaction, and a target serial number belongs to the key fields required to be recorded, so that the target serial number can be obtained from a current message, and comprises a global service tracking number and a sub-transaction serial number which run through the whole transaction process of the abnormal transaction.
In order to obtain accurate information of an abnormal transaction, in another embodiment of the present application, the positioning unit includes a first parsing subunit and a first determining subunit, where the first parsing subunit is configured to parse the global service tracking number and obtain a first parsing result, where the first parsing result at least includes a timestamp, a first system number, a first transaction instance serial number, and a serial number, the timestamp is a timestamp corresponding to the abnormal transaction when the transaction is initiated, the first system number is an identification code corresponding to an original initiator system of the abnormal transaction, the first transaction instance serial number is an identification code of a machine where a transaction instance corresponding to the abnormal transaction is located, and the serial number is a circularly incremented serial number generated by the original initiator system when the abnormal transaction is initiated; the first determining subunit is configured to determine information of the abnormal transaction according to the first parsing result. The global service tracking number is generated by the trigger point, and the consistency lasts until the time is completely finished, so that the information of the abnormal transaction is recorded in the global service tracking number.
The global service tracking number may be used as a database primary key in the system, the length of the primary key is required to be not too long for the primary key of the database, and in addition, considering that the global service tracking number has more components, the global service tracking number is set to 32 bits in a specific embodiment of the present application. The composition of the global service tracking number is shown in table one:
watch 1
The time stamp is as follows: generated by acquiring the local system time, belongs to the technical field.
The system number is as follows: all systems are organized according to the division of business functions, which is a code with business attributes, which is composed of 7 bits, which is derived from a unified standard. For example, the deposit system uses "1111111" and the money transfer system uses "2222222". The system number in the usage, global traffic tracking number is generated by the transaction initiator.
Transaction instance number above: this component belongs to the technology field. The generation flow is as shown in fig. 3, when the transaction instance serial number is initiated to be acquired, the transaction instance serial number is acquired from a local environment variable, the environment variable is an environment parameter configured in the server, if the environment variable exists, the environment variable is directly returned, if the environment variable does not exist, the environment variable is acquired from a starting parameter of the system, if the environment variable exists, the configuration of the transaction instance serial number is directly returned, and if the environment variable does not exist, the transaction instance serial number is generated through a local default implementation algorithm. The transaction instance sequence number in the global transaction tracking number is generated by the transaction initiator.
The generation of the sequence number: in the present application, the serial numbers are recycled, and the flow of their generation is shown in fig. 4. The serial number is self-increased by adopting Java native AtomicInteger, whether the result obtained after self-increasing is larger than 999999 is judged, if so, the serial number is set to be 1 and the character string formatting is carried out, and if not, the obtained result is carried out the character string formatting to generate the final serial number.
And splicing the generated 14-bit time stamp, 7-bit system code, 5-bit transaction instance serial number and 6-bit sequence number to obtain the generated global service tracking number. As shown in FIG. 5, assume that there is a transaction, the transaction link is shown in the following figure. The system A is used as a transaction initiator, the system A generates a global business tracking number of the transaction, and the system B and the system C can not generate the global business tracking number again. Each inter-system call in a transaction sends a global transaction tracking number to a downstream system.
In another embodiment of the present application, as shown in fig. 6, the apparatus further includes a second obtaining unit, a first calculating unit, and a second calculating unit, where the second obtaining unit is configured to obtain a MAC address corresponding to a machine where an original transaction instance corresponding to the abnormal transaction is located before the second obtaining unit is used to locate the abnormal transaction according to the target serial number to determine information of the abnormal transaction; the first computing unit is configured to compute a hash value corresponding to the MAC address, and perform a modulo operation on the hash value to obtain a modulo result; the second calculating unit is used for performing zero filling operation on the modulus taking result to obtain the first transaction instance serial number. In this embodiment, a hash value is calculated by using the MAC address of the machine where the original transaction instance is located, then a modulo operation is performed on the hash value, and finally a zero padding operation is performed on the result of the modulo operation, thereby obtaining an accurate serial number of the first transaction instance.
For example, if the transaction instance number is 5 bits, then 99999(5 by 9) is modulo, and if the transaction instance number is 6 bits, then 999999(6 by 9) is modulo. And finally, performing character string formatting (namely zero padding operation) on the modulus result to complete the generation of the transaction instance serial number.
In another embodiment of the present application, the positioning unit includes a third obtaining subunit, a second analyzing subunit, and a second determining subunit, where the third obtaining subunit is configured to obtain a target sub-transaction serial number from a plurality of sub-transaction serial numbers included in the target serial number, where the target sub-transaction serial number is a current sub-transaction serial number generated in a transaction process of the abnormal transaction; the second analysis subunit is configured to analyze the target sub-transaction serial number and obtain a second analysis result, where the second analysis result at least includes a second system number, a second transaction instance serial number, and a latest transaction arrangement number, the second system number is an identification code corresponding to the current call initiator system corresponding to the abnormal transaction, the second transaction instance serial number is an identification code of a machine where the transaction instance corresponding to the abnormal transaction generated by the current call initiator system is located, and the latest transaction arrangement number represents a call link to the system in a current call process from two dimensions, namely, a horizontal dimension and a vertical dimension; and the second determining subunit is configured to determine, according to the second analysis result, a corresponding calling system when the abnormal transaction is abnormal in the transaction link. In this embodiment, the target sub-transaction serial number needs to be first obtained to obtain a second system number, a second transaction instance serial number, and a latest transaction arrangement number, and the transaction link of the call initiation system and the call process of the abnormal transaction can be located through the second system number, the second transaction instance serial number, and the latest transaction arrangement number, so that the call system in which the abnormality occurs in the complex link can be quickly located.
The target sub-transaction serial number includes a second system number, a second transaction instance serial number, and a latest transaction arrangement number. The target sub-transaction serial number is mainly used for identifying each calling sub-branch of one transaction. The composition of the target sub-transaction serial number is shown in table two:
watch two
The second system number is different from the system number in the global service tracking number in that the second system number is generated by the current call initiator system.
The generation method of the transaction instance serial number is consistent with the method of the global service tracking number, but the difference is that the transaction instance serial number is generated by a calling initiator system.
The latest transaction arrangement number is composed of letters and numbers. The latest transaction arrangement number has 20 bits in total, which represents that the maximum support of the transaction level number is 20 layers, and the character value range of each bit in the latest transaction arrangement number is 1-9, A-Z, which represents that the maximum support of the same-level transaction instance number is 35. The latest transaction arrangement number represents a transaction calling link from two dimensions of horizontal and vertical, and is transmitted backwards along the transaction link. The initial value of the latest transaction serial number is all 0, and the latest transaction serial number can be subjected to layer-ascending or ascending logic every time system calling occurs on a transaction link.
In yet another embodiment of the present application, the apparatus includes a third obtaining unit and a generating unit, where the third obtaining unit is configured to obtain current system call information corresponding to the abnormal transaction in a transaction link before positioning the abnormal transaction according to the target serial number to determine a corresponding call system when the abnormal transaction is abnormal in the transaction link, where the current system call information at least includes information of the current call initiator system and information of the currently called system corresponding to the abnormal transaction; the generating unit is used for generating the target sub-transaction serial number according to the current system calling information. In this embodiment, the target sub-transaction serial number is generated according to the call information of the current system, so that the system with abnormal transaction can be located according to the target sub-transaction serial number, and the call system with abnormal transaction can be located more quickly.
In a specific embodiment of the present application, after receiving a message transmitted by an upstream system, an offspring transaction serial number in the message is stored in a customized context, and the customized context is implemented using a thread class native to JAVA. Thread local is a storage class inside a thread, and can store data in a specified thread, and after the data is stored, only the specified thread can obtain the stored data. Thread local has a thread isolation effect by using a single memory space for each thread, and the corresponding value can be obtained only in the thread, and the desired value cannot be accessed outside the thread. Therefore, the current thread for transaction can acquire the sub-transaction serial number transmitted from the upstream system to the system through the customized context.
And creating a data structure of the stack in the custom context, wherein the data structure is used for storing the newly generated sub-transaction serial number and is marked as a sub-transaction serial number stack. The number of the sub-transaction serial numbers stored at the beginning of the stack is 0, the sub-transaction serial numbers are pressed into the stack when a new sub-transaction serial number is generated, and the elements at the top of the stack are the latest sub-transaction serial numbers forever. It should be noted that there are two attributes in the custom context for storing the sub-transaction serial number, and the difference between the two attributes, which are denoted as substxno and substxnotack in the present application, is shown in table three below.
Watch III
When the layer upgrading of the sub-transaction sequence numbers is needed, whether the number of elements in the sub-transaction sequence number stack subTxNOStack is 0 or not is mainly used for judging, if the number of the elements in the sub-transaction sequence number stack subTxNOStack is 0, the generation of the sub-transaction sequence numbers is not performed by the current system, and the logic of layer upgrading is performed when the current system calls the external system for the first time. When the layer is upgraded, the sub-transaction sequence number subTxNo transmitted to the system by the upstream system needs to be taken out from the custom context, the logic of the layer upgrading of the sub-transaction sequence number in the section is completed by taking the sub-transaction sequence number subTxNo as a reference, and finally the newly generated sub-transaction sequence number is pressed into a sub-transaction sequence number stack subTxNoStack of the custom context.
When the sub-transaction sequence number rises, the judgment is also carried out according to whether the number of elements in the sub-transaction sequence number stack subTxNOStack is 0, if not, the generation of the sub-transaction sequence number is shown by the current system, and the logic of rising is carried out when the current system is not the first calling external system. When the sub-transaction sequence number is increased, the sub-transaction sequence number at the top of the stack needs to be obtained from the sub-transaction sequence number stack subTxNOStack, the logic of increasing the sub-transaction sequence number in the section is completed by taking the sub-transaction sequence number as a reference, and finally, the newly generated sub-transaction sequence number is pressed into the sub-transaction sequence number stack subTxNOStack.
And when the caller system needs to generate the sub-transaction serial number, returning the stack top element of the sub-transaction serial number stack with the self-defined context to the system.
In another embodiment of the present application, the generating unit includes a fourth acquiring subunit, a first generating subunit, a third determining subunit, a fourth determining subunit, a fifth determining subunit, a second generating subunit, a fifth acquiring subunit, and a sixth determining subunit, where the fourth acquiring subunit is configured to acquire the identifier corresponding to the current call initiator system, and determine the identifier as a prefix of the target sub-transaction serial number; the first generating subunit is configured to generate the target sub-transaction serial number to obtain a transaction instance serial number; the third determining subunit is configured to determine that the current system is located at a level of the transaction link, and determine a level number corresponding to the level; the fourth determining subunit is configured to determine a number of the current system at the current level of the transaction link; the fifth determining subunit is configured to determine the number of characters included in the target sub-transaction serial number; the second generating subunit is configured to sequentially arrange the prefixes and the hierarchical numbers, determine characters other than the prefixes and the hierarchical numbers to be 0, and generate a reference serial number corresponding to the target sub-transaction serial number; the fifth obtaining subunit is configured to obtain a calling condition that the current call initiator system calls the current called system, and adjust the reference serial number according to the calling condition; the sixth determining subunit is configured to determine the adjusted reference serial number as the target sub-transaction serial number. In this embodiment, a prefix of the calling and originating system and a hierarchical number of the exchange are determined, then the number of characters in the target sub-transaction serial number is determined, the prefix and the hierarchical number are arranged in sequence, and the characters except the prefix and the hierarchical number are determined to be 0, so that the target sub-transaction serial number is generated.
The process for generating the target sub-transaction serial number specifically comprises the following steps: taking the transaction link shown in fig. 7 as an example, the link focuses on the generation flow of the latest transaction arrangement number, and the system number and the transaction instance number in the sub-transaction number are represented by using corresponding placeholders in a unified manner, for example, the system a uses the letter "a" to represent the system number and the transaction instance number, the system B uses the letter "B" to represent the system number and the transaction instance number, and so on.
(1) The system a generates the first sub-transaction serial number of the transaction as the transaction initiator, and the sub-transaction serial number is "a 1000000000000000000". The system A is used as a transaction initiator, the transaction level number of the system A is 1, so that the first bit in the corresponding latest transaction arrangement number is 1, and the last 19 bits are 0;
(2) system a first calls system B, then system C, and then system D.
At this time, three new sub-transaction sequence numbers need to be generated to represent the three call branches, and the system number and the transaction instance sequence number in the three sub-transaction sequence numbers are all generated by the system a, so the prefixes of the sub-transaction sequence numbers are all a. For the first time, the system A calls the system B, which belongs to the external system called by the system A for the first time, so that the logic of upgrading is needed, and the sub-transaction serial number obtained by taking the first sub-transaction serial number 'A1000000000000000000' as the reference according to the logic of upgrading is 'A110000000000000'; secondly, the system A calls the system C, the non-system A calls the external system for the first time, so that the ascending logic is needed, the above one sub-transaction serial number 'A1100000000000000000' is used as a reference, and the obtained sub-transaction serial number is 'A120000000000000' according to the ascending logic; thirdly, the system A calls the system D, the non-system A calls the external system for the first time, so that the ascending logic is needed, the sub-transaction serial number is 'A13000000000000000000000' according to the ascending logic with the above one sub-transaction serial number 'A1200000000000000000' as the reference.
(3) System B calls system E and system B calls system F. At this time, two new sub-transaction serial numbers need to be generated to represent the two call sub-branches, and the system number and the transaction instance serial number in the two sub-transaction serial numbers are generated by the system B. For the first time, the system B calls the system E, which belongs to the external system called by the system B for the first time, so that the logic of ascending a layer is needed, the previous sub-transaction serial number 'A110000000000000' is taken as a reference, and the generated sub-transaction serial number is 'B111000000000000'; secondly, the system B calls the system F, the non-system B calls the external system for the first time, and therefore the ascending logic is required, and the sub-transaction serial number obtained according to the ascending logic with the previous sub-transaction serial number "B11100000000000000000000" as the reference.
(4) System D calls system G. At this time, a new sub-transaction serial number is generated to represent the call sub-branch, and the system number and the transaction instance serial number of the sub-transaction serial number are generated by the system D. The system D calls the system G, belongs to the external system called by the system D for the first time, therefore, the logic of ascending the layer is needed, the sub-transaction serial number is 'D1310000000000000000' according to the logic of ascending the layer, and the obtained sub-transaction serial number is 'A1300000000000000000'. At this point, the latest transaction arrangement number generation process of the transaction link is completed.
Taking the generated target sub-transaction serial number "D1310000000000000000" as an example, it can be known that the system caller is system D; in the latest transaction arrangement number of the last 20 digits, 3 non-0 characters are totally contained, which indicates that the transaction level number of the current system in the transaction link is 3; and finding the position of the latest transaction arrangement number, in which the character 0 appears from left to right, and recording the position as pos, wherein pos is subtracted by one, and the corresponding character is '1', which indicates that the current system is the first system called by the system D.
In order to more quickly locate a system with an exception, in another embodiment of the present application, the fifth obtaining subunit includes a determining module, a first adjusting module, and a second adjusting module, where the determining module is configured to determine whether the current calling initiator system is an external system for the first time when the current calling initiator system calls the current called system; the first adjusting module is configured to perform layer-up processing on the reference serial number so as to convert a character with a first bit of 0 in the reference serial number into 1 when the external system is called for the first time by the current calling initiator system; the second adjusting module is configured to, when the current call initiator system does not call the external system for the first time, perform an ascending process on the reference sequence number to adjust a level number in the reference sequence number by adding 1. In this embodiment, according to whether the calling initiator system calls the external system for the first time, the layer-up logic or the layer-up logic is performed, so that the calling condition of the current system can be obtained according to the first bit in the reference sequence number and the layer number.
In a specific embodiment of the present application, as shown in fig. 8, the layer-ascending logic needs to find a position where a character 0 appears first in the latest transaction serial number from left to right, if the position exists, the character 0 is modified to 1, that is, the layer-ascending logic of the latest transaction serial number is completed, and if the position does not exist, it indicates that the transaction level number has reached the maximum, and the layer cannot be continuously upgraded.
In another specific embodiment of the present application, the ascending order logic is shown in FIG. 9, which first finds the position of the first occurrence of character 0 from left to right in the latest transaction arrangement, and records the position as pos. If pos exists, acquiring a character of the pos minus 1 position, then judging whether the character is Z counting, carrying out binary operation, if so, indicating that the number of the transaction instances of the same level reaches the maximum, and if not, carrying out self increment on the character. Character incrementing requires that when the character is 9, the result after incrementing is a. If pos does not exist, the last character in the latest transaction arrangement number is obtained, then whether the character is Z or not is judged, and the following steps are consistent with the previous steps.
The device for positioning the abnormal transactions comprises a processor and a memory, wherein the acquisition unit, the positioning unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the problem that a system with abnormity is difficult to locate when the transaction serial number is abnormal in the related technology is solved by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a non-volatile storage medium, on which a program is stored, where the program, when executed by a processor, implements the above method for locating an abnormal transaction.
The embodiment of the invention provides a processor, which is used for running a program, wherein the method for positioning the abnormal transaction is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps:
step S101, under the condition that abnormal transactions exist in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transactions;
and step S102, positioning the abnormal transaction according to the target serial number to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, wherein the calling system comprises a transaction calling initiator system. .
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The invention also provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
step S101, under the condition that abnormal transactions exist in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transactions;
and step S102, positioning the abnormal transaction according to the target serial number to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, wherein the calling system comprises a transaction calling initiator system. .
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable non-volatile storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer non-volatile storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable non-volatile storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
From the above description, it can be seen that the above-described embodiments of the present application achieve the following technical effects:
1) according to the method for positioning the abnormal transactions, firstly, under the condition that the abnormal transactions are detected in a plurality of transactions, a target serial number corresponding to the abnormal transactions is obtained, then, the abnormal transactions are positioned according to the target serial number, information of the abnormal transactions and a calling system corresponding to the abnormal transactions are determined, and the calling system comprises an initiator system and a called system for calling the transactions. According to the method, the target serial number of the abnormal transaction is acquired to have uniqueness, one transaction can be uniquely positioned, and each system called by the transaction link can be described, so that the information of the abnormal transaction and the calling system when the abnormal transaction occurs can be positioned according to the target serial number, the abnormal system can be positioned according to the target serial number, and the technical problem that the abnormal system is difficult to position under the condition that the transaction is abnormal in the related technology is solved.
2) The device for positioning the abnormal transactions comprises an acquisition unit and a positioning unit, wherein the acquisition unit is used for acquiring a target serial number corresponding to the abnormal transactions under the condition that the abnormal transactions are detected to exist in a plurality of transactions, the positioning unit is used for positioning the abnormal transactions according to the target serial number, determining information of the abnormal transactions and a calling system corresponding to the abnormal transactions when the abnormal transactions occur, and the calling system comprises an initiator system for calling the transactions and a called system. In the device, the target serial number of the abnormal transaction is acquired to have uniqueness, one transaction can be uniquely positioned, and each system called by the transaction link can be described, so that the information of the abnormal transaction and the calling system when the abnormal transaction occurs can be positioned according to the target serial number, the abnormal system can be positioned according to the target serial number, and the technical problem that the abnormal system is difficult to position under the condition that the abnormal transaction occurs in the transaction serial number in the related technology is solved.
The above description is only an example of the present invention and is not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims (11)
1. A method for locating anomalous transactions comprising:
under the condition that abnormal transactions exist in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transactions;
and positioning the abnormal transaction according to the target serial number to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, wherein the calling system comprises a transaction calling initiator system.
2. The method according to claim 1, wherein in a case that it is detected that there is an abnormal transaction in a plurality of transactions, acquiring a target serial number corresponding to the abnormal transaction, including:
under the condition that abnormal transactions exist in a plurality of transactions, acquiring a current message generated in the transaction process of the abnormal transactions;
and acquiring the target serial number contained in the message, wherein the target serial number comprises a global service tracking number corresponding to the abnormal transaction and a sub-transaction serial number corresponding to the abnormal transaction, and the global service tracking number runs through the whole transaction process corresponding to the abnormal transaction.
3. The method of claim 2, wherein locating the abnormal transaction according to the target serial number to determine information of the abnormal transaction comprises:
analyzing the global service tracking number and obtaining a first analysis result, wherein the first analysis result at least comprises a timestamp, a first system number, a first transaction instance serial number and a serial number, the timestamp is the timestamp corresponding to the abnormal transaction when the transaction is initiated, the first system number is an identification code corresponding to an original initiator system of the abnormal transaction, the first transaction instance serial number is the identification code of a machine where the transaction instance corresponding to the abnormal transaction is located, and the serial number is a circularly-increased serial number generated by the original initiator system when the abnormal transaction is initiated;
and determining the information of the abnormal transaction according to the first analysis result.
4. The method of claim 3, wherein prior to locating the anomalous transaction based on the target serial number to determine information about the anomalous transaction, the method further comprises:
acquiring an MAC address corresponding to a machine where an original transaction instance corresponding to the abnormal transaction is located;
calculating a hash value corresponding to the MAC address, and performing a modulus operation on the hash value to obtain a modulus result;
and carrying out zero filling operation on the modulus result to obtain the first transaction instance serial number.
5. The method of claim 2, wherein locating the abnormal transaction according to the target serial number to determine a calling system corresponding to the abnormal transaction when an abnormality occurs in a transaction link comprises:
acquiring a target sub-transaction serial number contained in the target serial number, wherein the target sub-transaction serial number is a current sub-transaction serial number generated in the transaction process of the abnormal transaction;
analyzing the target sub-transaction serial number and obtaining a second analysis result, wherein the second analysis result at least comprises a second system number, a second transaction instance serial number and a latest transaction arrangement number, the second system number is an identification code corresponding to the current calling initiator system corresponding to the abnormal transaction, the second transaction instance serial number is an identification code of a machine where the transaction instance corresponding to the current calling initiator system is located, and the latest transaction arrangement number represents a call link to the system in the current calling process from two dimensions, namely a horizontal dimension and a longitudinal dimension;
and determining a corresponding calling system when the abnormal transaction is abnormal in the transaction link according to the second analysis result.
6. The method of claim 5, wherein before locating the abnormal transaction according to the target serial number to determine a corresponding calling system when the abnormal transaction is abnormal in a transaction link, the method comprises:
acquiring current system call information corresponding to the abnormal transaction in the transaction link, wherein the current system call information at least comprises information of the current call initiator system corresponding to the abnormal transaction and information of the current called system;
and generating the target sub-transaction serial number according to the current system calling information.
7. The method of claim 6, wherein generating the target sub-transaction sequence number according to the current system call information comprises:
acquiring an identification code corresponding to the current calling initiator system, and determining the identification code as a prefix of the target sub-transaction serial number;
determining the level of the transaction link where the current system is located, and determining a number corresponding to the level of the transaction link;
arranging the prefixes and the numbers in sequence, and determining characters except the prefixes and the hierarchy numbers to be 0 so as to generate a reference serial number corresponding to the target sub-transaction serial number;
acquiring the calling condition of the current calling initiator system for calling the current called system, and adjusting the reference serial number according to the calling condition;
and determining the adjusted reference serial number as the target sub-transaction serial number.
8. The method of claim 7, wherein obtaining a call condition of the current call initiator system calling the current called system, and adjusting the reference sequence number according to the call condition comprises:
judging whether the current calling initiator system is an external system for the first calling when the current called system is called by the current calling initiator system;
under the condition that the current calling initiator system calls the external system for the first time, performing layer-ascending processing on the reference serial number to convert a character with a first bit of 0 in the reference serial number into 1;
and under the condition that the current calling initiator system does not call the external system for the first time, performing ascending processing on the reference sequence number to adjust the level number in the reference sequence number to be added with 1.
9. An apparatus for locating anomalous transactions, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target serial number corresponding to an abnormal transaction when the abnormal transaction is detected in a plurality of transactions;
and the positioning unit is used for positioning the abnormal transaction according to the target serial number so as to determine the information of the abnormal transaction and a corresponding calling system when the abnormal transaction is abnormal in a transaction link, and the calling system comprises a transaction calling initiator system.
10. A non-volatile storage medium, comprising a stored program, wherein the program, when executed, controls a device in which the non-volatile storage medium is located to perform a method for locating an exception transaction according to any one of claims 1 to 8.
11. A processor configured to run a program, wherein the program when running performs the method for locating anomalous transactions according to any one of the claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210234282.6A CN114691732A (en) | 2022-03-09 | 2022-03-09 | Method and device for positioning abnormal transaction, nonvolatile storage medium and processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210234282.6A CN114691732A (en) | 2022-03-09 | 2022-03-09 | Method and device for positioning abnormal transaction, nonvolatile storage medium and processor |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114691732A true CN114691732A (en) | 2022-07-01 |
Family
ID=82138840
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210234282.6A Pending CN114691732A (en) | 2022-03-09 | 2022-03-09 | Method and device for positioning abnormal transaction, nonvolatile storage medium and processor |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114691732A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115904872A (en) * | 2022-12-01 | 2023-04-04 | 深圳市雁联计算系统有限公司 | Transaction link monitoring method, system and storage medium |
CN115936608A (en) * | 2022-12-01 | 2023-04-07 | 深圳市雁联计算系统有限公司 | Distributed serial number generation method and device based on transaction link and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109767329A (en) * | 2018-12-29 | 2019-05-17 | 北京金山安全软件有限公司 | Abnormal transaction detection method and device, electronic equipment and storage medium |
CN110223173A (en) * | 2019-05-20 | 2019-09-10 | 深圳壹账通智能科技有限公司 | Trade link abnormality eliminating method and relevant device |
CN112446786A (en) * | 2020-11-13 | 2021-03-05 | 中信银行股份有限公司 | Abnormal transaction processing method and device, electronic equipment and readable storage medium |
CN113128986A (en) * | 2021-04-23 | 2021-07-16 | 中国工商银行股份有限公司 | Error reporting processing method and device for long-link transaction |
CN114092246A (en) * | 2021-11-24 | 2022-02-25 | 中国银行股份有限公司 | Problem positioning method and device for financial transaction link |
-
2022
- 2022-03-09 CN CN202210234282.6A patent/CN114691732A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109767329A (en) * | 2018-12-29 | 2019-05-17 | 北京金山安全软件有限公司 | Abnormal transaction detection method and device, electronic equipment and storage medium |
CN110223173A (en) * | 2019-05-20 | 2019-09-10 | 深圳壹账通智能科技有限公司 | Trade link abnormality eliminating method and relevant device |
WO2020233066A1 (en) * | 2019-05-20 | 2020-11-26 | 深圳壹账通智能科技有限公司 | Abnormity processing method based on data computation link, and related device |
CN112446786A (en) * | 2020-11-13 | 2021-03-05 | 中信银行股份有限公司 | Abnormal transaction processing method and device, electronic equipment and readable storage medium |
CN113128986A (en) * | 2021-04-23 | 2021-07-16 | 中国工商银行股份有限公司 | Error reporting processing method and device for long-link transaction |
CN114092246A (en) * | 2021-11-24 | 2022-02-25 | 中国银行股份有限公司 | Problem positioning method and device for financial transaction link |
Non-Patent Citations (1)
Title |
---|
喻乐平;龚伟;刘武贵;: "基于ESB发布订阅模式下的业务数据异常处理解决方案", 电子世界, no. 09, 8 May 2019 (2019-05-08) * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115904872A (en) * | 2022-12-01 | 2023-04-04 | 深圳市雁联计算系统有限公司 | Transaction link monitoring method, system and storage medium |
CN115936608A (en) * | 2022-12-01 | 2023-04-07 | 深圳市雁联计算系统有限公司 | Distributed serial number generation method and device based on transaction link and storage medium |
CN115936608B (en) * | 2022-12-01 | 2024-03-05 | 深圳市雁联计算系统有限公司 | Distributed serial number generation method and device based on transaction link and storage medium |
CN115904872B (en) * | 2022-12-01 | 2024-03-12 | 深圳市雁联计算系统有限公司 | Transaction link monitoring method, system and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114691732A (en) | Method and device for positioning abnormal transaction, nonvolatile storage medium and processor | |
CN108932257B (en) | Multi-dimensional data query method and device | |
CN110162526B (en) | Method, device and equipment for inquiring data records in block chain type account book | |
CN106897335B (en) | Service data storage method, record identifier generation method and device | |
TW201800967A (en) | Method and device for processing distributed streaming data | |
CN106897342B (en) | Data verification method and equipment | |
CN109672608B (en) | Method for transmitting messages according to time | |
JP2019504426A (en) | Method and apparatus for generating random character string | |
CN111930497A (en) | Resource allocation method, device and medium based on block chain and static code | |
CN112347355A (en) | Data processing method, device, server and storage medium | |
CN114493551B (en) | Contract generation method and device, electronic equipment and storage medium | |
CN114490641A (en) | Industrial Internet data sharing method, equipment and medium | |
CN105468623A (en) | Data processing method and apparatus | |
CN106878365B (en) | data synchronization method and device | |
CN112162951A (en) | Information retrieval method, server and storage medium | |
CN109068286B (en) | Information analysis method, medium and equipment | |
CN116894052A (en) | Material list comparison method, device, storage medium and processor | |
CN110020348B (en) | Early warning method and device for circled events | |
CN109213821B (en) | Data processing method and system | |
CN110968599B (en) | Inquiry method and device based on Impala | |
CN115878631B (en) | Method and apparatus for altering a table structure of a database table | |
CN118428376B (en) | Method, device and storage medium for translating engineering materials | |
CN117390060A (en) | Batch data unloading processing method and device, electronic equipment and readable storage medium | |
CN115034207A (en) | Method, system, equipment and storage medium for verifying identification data | |
CN114629788A (en) | Configuration information updating method, system, storage medium and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |