WO2023085619A1 - 데이터베이스를 복구하는 전자 장치 및 그 동작 방법 - Google Patents

데이터베이스를 복구하는 전자 장치 및 그 동작 방법 Download PDF

Info

Publication number
WO2023085619A1
WO2023085619A1 PCT/KR2022/015546 KR2022015546W WO2023085619A1 WO 2023085619 A1 WO2023085619 A1 WO 2023085619A1 KR 2022015546 W KR2022015546 W KR 2022015546W WO 2023085619 A1 WO2023085619 A1 WO 2023085619A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
electronic device
metadata
data
damaged
Prior art date
Application number
PCT/KR2022/015546
Other languages
English (en)
French (fr)
Inventor
전혜은
이기성
신윤호
Original Assignee
삼성전자주식회사
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Priority claimed from KR1020210168020A external-priority patent/KR20230070986A/ko
Application filed by 삼성전자주식회사 filed Critical 삼성전자주식회사
Priority to EP22893042.6A priority Critical patent/EP4345624A1/en
Priority to US17/994,229 priority patent/US20230153291A1/en
Publication of WO2023085619A1 publication Critical patent/WO2023085619A1/ko

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Definitions

  • Various embodiments of the present disclosure relate to an electronic device for restoring a database and an operating method thereof.
  • An electronic device may manage data of one or more applications, services, and/or operating systems based on a database.
  • the electronic device may process data of the database based on an application, service, and/or operating system being executed.
  • database corruption may occur due to various causes, such as an unexpected system or hardware error or an application or runtime library error.
  • the database engine used in the Android OS may be SQLite, and due to the nature of the database, if the header or schema is broken, access to the database becomes impossible due to inability to access important metadata, and even if some data in the database is damaged. Other data cannot be accessed, and database initialization may occur. When database initialization occurs, important user data such as contacts, messages, and notes may also be lost.
  • a technique for recovering a corresponding database at runtime on an Android device may be provided.
  • the runtime database recovery technique the user can be guaranteed to use the corresponding application and/or data without loss of important data.
  • An aspect of the present disclosure is to solve at least the problems and/or disadvantages noted above and provide at least the advantages described below. Accordingly, one aspect of the present disclosure is to provide an electronic device and an operating method of the electronic device for restoring a database.
  • an electronic device may include a non-volatile first memory storing a database, a volatile second memory, and a processor operably connected to the first memory and the second memory.
  • the processor determines whether the database is corrupted, and if it is determined that the database is corrupted, initializes a DB cache in which at least a part of the database is loaded into the user area of the second memory, and then checks the first integrity of the database. (first integrity check) is performed, and if the first integrity check of the database fails, at least a part of the database is loaded into the kernel area of the second memory, an OS cache (operating system cache) is initialized, and then the second integrity check of the database is performed. and if the first integrity check or the second integrity check of the database succeeds, a database file operation may be performed.
  • a method for operating an electronic device includes an operation of determining whether a database stored in a non-volatile first memory of an electronic device is damaged, and if it is determined that the database is damaged, after initializing a DB cache in which at least a part of the database is loaded into a user area of the second memory, Performing a first integrity check of the database, if the first integrity check of the database fails, initializing an OS cache in which at least a part of the database is loaded into the kernel area of the second memory, and then performing a second integrity check of the database Operation and if the first integrity check or the second integrity check of the database succeeds, an operation of performing a job on the database file may be included.
  • an advanced integrity verification-based recovery technique when a database is damaged, an advanced integrity verification-based recovery technique, a backup metadata recovery technique, a template recovery technique, and other recovery techniques are sequentially executed, thereby normally recovering a lost database or recovering lost data. can be minimized.
  • the user can be guaranteed to use the corresponding application and/or data without losing important data.
  • FIG. 1 shows a block diagram of an electronic device in a network environment according to an embodiment of the present disclosure.
  • FIG. 2 is a block diagram illustrating a program according to one embodiment of the present disclosure.
  • FIG. 3 is a diagram for explaining an operation related to a database stored in an electronic device according to an embodiment of the present disclosure.
  • FIG. 4 is a diagram for explaining an operation of restoring damage to a database according to an embodiment of the present disclosure.
  • 5 and 6 are diagrams for explaining an advanced integrity verification based recovery operation according to various embodiments of the present disclosure.
  • FIGS 7 to 10 are diagrams for explaining backup metadata recovery operations according to various embodiments of the present disclosure.
  • 11 and 12 are diagrams for explaining a template recovery operation according to various embodiments of the present disclosure.
  • FIG. 13 is a diagram for explaining other recovery operations according to an embodiment of the present disclosure.
  • FIG. 14 is a diagram illustrating an operating method of an electronic device according to an embodiment of the present disclosure.
  • 15 is a diagram illustrating an electronic device according to an embodiment of the present disclosure.
  • FIG. 1 shows a block diagram of an electronic device in a network environment according to an embodiment of the present disclosure.
  • FIG. 1 is a block diagram of an electronic device 101 within a network environment 100, according to various embodiments.
  • an electronic device 101 communicates with an electronic device 102 through a first network 198 (eg, a short-range wireless communication network) or through a second network 199. It may communicate with at least one of the electronic device 104 or the server 108 through (eg, a long-distance wireless communication network). According to one embodiment, the electronic device 101 may communicate with the electronic device 104 through the server 108 .
  • a first network 198 eg, a short-range wireless communication network
  • the server 108 e.g, a long-distance wireless communication network
  • the electronic device 101 includes a processor 120, a memory 130, an input module 150, an audio output module 155, a display module 160, an audio module 170, a sensor module ( 176), interface 177, connection terminal 178, haptic module 179, camera module 180, power management module 188, battery 189, communication module 190, subscriber identification module 196 , or the antenna module 197 may be included.
  • at least one of these components eg, the connection terminal 178) may be omitted or one or more other components may be added.
  • some of these components eg, sensor module 176, camera module 180, or antenna module 197) are integrated into a single component (eg, display module 160). It can be.
  • the processor 120 for example, executes software (eg, the program 140) to cause at least one other component (eg, hardware or software component) of the electronic device 101 connected to the processor 120. It can control and perform various data processing or calculations. According to one embodiment, as at least part of data processing or operation, the processor 120 transfers instructions or data received from other components (e.g., sensor module 176 or communication module 190) to volatile memory 132. , processing commands or data stored in the volatile memory 132 , and storing resultant data in the non-volatile memory 134 .
  • software eg, the program 140
  • the processor 120 transfers instructions or data received from other components (e.g., sensor module 176 or communication module 190) to volatile memory 132. , processing commands or data stored in the volatile memory 132 , and storing resultant data in the non-volatile memory 134 .
  • the processor 120 may include a main processor 121 (eg, a central processing unit or an application processor) or a secondary processor 123 (eg, a graphics processing unit (GPU) that may operate independently of or in conjunction with the main processor 121). unit), a neural processing unit (NPU), an image signal processor, a sensor hub processor, or a communication processor).
  • a main processor 121 eg, a central processing unit or an application processor
  • a secondary processor 123 eg, a graphics processing unit (GPU) that may operate independently of or in conjunction with the main processor 121). unit), a neural processing unit (NPU), an image signal processor, a sensor hub processor, or a communication processor.
  • the auxiliary processor 123 may use less power than the main processor 121 or be set to be specialized for a designated function.
  • the secondary processor 123 may be implemented separately from or as part of the main processor 121 .
  • the secondary processor 123 may, for example, take the place of the main processor 121 while the main processor 121 is in an inactive (eg, sleep) state, or the main processor 121 is active (eg, running an application). ) state, together with the main processor 121, at least one of the components of the electronic device 101 (eg, the display module 160, the sensor module 176, or the communication module 190) It is possible to control at least some of the related functions or states.
  • the auxiliary processor 123 eg, image signal processor or communication processor
  • the auxiliary processor 123 may include a hardware structure specialized for processing an artificial intelligence model.
  • AI models can be created through machine learning. Such learning may be performed, for example, in the electronic device 101 itself where the artificial intelligence model is performed, or may be performed through a separate server (eg, the server 108).
  • the learning algorithm may include, for example, supervised learning, unsupervised learning, semi-supervised learning or reinforcement learning, but in the above example Not limited.
  • the artificial intelligence model may include a plurality of artificial neural network layers.
  • Artificial neural networks include deep neural networks (DNNs), convolutional neural networks (CNNs), recurrent neural networks (RNNs), restricted boltzmann machines (RBMs), deep belief networks (DBNs), bidirectional recurrent deep neural networks (BRDNNs), It may be one of deep Q-networks or a combination of two or more of the foregoing, but is not limited to the foregoing examples.
  • the artificial intelligence model may include, in addition or alternatively, software structures in addition to hardware structures.
  • the memory 130 may store various data used by at least one component (eg, the processor 120 or the sensor module 176) of the electronic device 101 .
  • the data may include, for example, input data or output data for software (eg, program 140) and commands related thereto.
  • the memory 130 may include volatile memory 132 or non-volatile memory 134 .
  • the program 140 may be stored as software in the memory 130 and may include, for example, an operating system 142 , middleware 144 , or an application 146 .
  • the input module 150 may receive a command or data to be used by a component (eg, the processor 120) of the electronic device 101 from the outside of the electronic device 101 (eg, a user).
  • the input module 150 may include, for example, a microphone, a mouse, a keyboard, a key (eg, a button), or a digital pen (eg, a stylus pen).
  • the sound output module 155 may output sound signals to the outside of the electronic device 101 .
  • the sound output module 155 may include, for example, a speaker or a receiver.
  • the speaker can be used for general purposes such as multimedia playback or recording playback.
  • a receiver may be used to receive an incoming call. According to one embodiment, the receiver may be implemented separately from the speaker or as part of it.
  • the display module 160 may visually provide information to the outside of the electronic device 101 (eg, a user).
  • the display module 160 may include, for example, a display, a hologram device, or a projector and a control circuit for controlling the device.
  • the display module 160 may include a touch sensor set to detect a touch or a pressure sensor set to measure the intensity of force generated by the touch.
  • the audio module 170 may convert sound into an electrical signal or vice versa. According to one embodiment, the audio module 170 acquires sound through the input module 150, the sound output module 155, or an external electronic device connected directly or wirelessly to the electronic device 101 (eg: Sound may be output through the electronic device 102 (eg, a speaker or a headphone).
  • the audio module 170 acquires sound through the input module 150, the sound output module 155, or an external electronic device connected directly or wirelessly to the electronic device 101 (eg: Sound may be output through the electronic device 102 (eg, a speaker or a headphone).
  • the sensor module 176 detects an operating state (eg, power or temperature) of the electronic device 101 or an external environmental state (eg, a user state), and generates an electrical signal or data value corresponding to the detected state. can do.
  • the sensor module 176 may include, for example, a gesture sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a grip sensor, a proximity sensor, a color sensor, an IR (infrared) sensor, a bio sensor, It may include a temperature sensor, humidity sensor, or light sensor.
  • the interface 177 may support one or more designated protocols that may be used to directly or wirelessly connect the electronic device 101 to an external electronic device (eg, the electronic device 102).
  • the interface 177 may include, for example, a high definition multimedia interface (HDMI), a universal serial bus (USB) interface, an SD card interface, or an audio interface.
  • HDMI high definition multimedia interface
  • USB universal serial bus
  • SD card interface Secure Digital Card interface
  • audio interface audio interface
  • connection terminal 178 may include a connector through which the electronic device 101 may be physically connected to an external electronic device (eg, the electronic device 102).
  • the connection terminal 178 may include, for example, an HDMI connector, a USB connector, an SD card connector, or an audio connector (eg, a headphone connector).
  • the haptic module 179 may convert electrical signals into mechanical stimuli (eg, vibration or motion) or electrical stimuli that a user may perceive through tactile or kinesthetic senses.
  • the haptic module 179 may include, for example, a motor, a piezoelectric element, or an electrical stimulation device.
  • the camera module 180 may capture still images and moving images. According to one embodiment, the camera module 180 may include one or more lenses, image sensors, image signal processors, or flashes.
  • the power management module 188 may manage power supplied to the electronic device 101 .
  • the power management module 188 may be implemented as at least part of a power management integrated circuit (PMIC), for example.
  • PMIC power management integrated circuit
  • the battery 189 may supply power to at least one component of the electronic device 101 .
  • the battery 189 may include, for example, a non-rechargeable primary cell, a rechargeable secondary cell, or a fuel cell.
  • the communication module 190 is a direct (eg, wired) communication channel or a wireless communication channel between the electronic device 101 and an external electronic device (eg, the electronic device 102, the electronic device 104, or the server 108). Establishment and communication through the established communication channel may be supported.
  • the communication module 190 may include one or more communication processors that operate independently of the processor 120 (eg, an application processor (AP)) and support direct (eg, wired) communication or wireless communication. there is.
  • AP application processor
  • the communication module 190 is a wireless communication module 192 (eg, a cellular communication module, a short-range wireless communication module, or a global navigation satellite system (GNSS) communication module) or a wired communication module 194 (eg, : a local area network (LAN) communication module or a power line communication module).
  • a corresponding communication module is a first network 198 (eg, a short-range communication network such as Bluetooth, wireless fidelity (WiFi) direct, or infrared data association (IrDA)) or a second network 199 (eg, a legacy communication module).
  • the wireless communication module 192 uses subscriber information (eg, International Mobile Subscriber Identifier (IMSI)) stored in the subscriber identification module 196 within a communication network such as the first network 198 or the second network 199.
  • IMSI International Mobile Subscriber Identifier
  • the wireless communication module 192 may support a 5G network after a 4G network and a next-generation communication technology, for example, NR access technology (new radio access technology).
  • NR access technologies include high-speed transmission of high-capacity data (enhanced mobile broadband (eMBB)), minimization of terminal power and access of multiple terminals (massive machine type communications (mMTC)), or high reliability and low latency (ultra-reliable and low latency (URLLC)).
  • eMBB enhanced mobile broadband
  • mMTC massive machine type communications
  • URLLC ultra-reliable and low latency
  • -latency communications can be supported.
  • the wireless communication module 192 may support, for example, a high frequency band (eg, a millimeter (mm) Wave band) to achieve a high data rate.
  • mm millimeter
  • the wireless communication module 192 uses various technologies for securing performance in a high frequency band, such as beamforming, massive multiple-input and multiple-output (MIMO), and full-dimensional multiplexing. Technologies such as input/output (FD-MIMO: full dimensional MIMO), array antenna, analog beam-forming, or large-scale antenna may be supported.
  • the wireless communication module 192 may support various requirements defined for the electronic device 101, an external electronic device (eg, the electronic device 104), or a network system (eg, the second network 199).
  • the wireless communication module 192 is a peak data rate for eMBB realization (eg, 20 Gbps or more), a loss coverage for mMTC realization (eg, 164 dB or less), or a U-plane latency for URLLC realization (eg, Example: downlink (DL) and uplink (UL) each of 0.5 ms or less, or round trip 1 ms or less) may be supported.
  • eMBB peak data rate for eMBB realization
  • a loss coverage for mMTC realization eg, 164 dB or less
  • U-plane latency for URLLC realization eg, Example: downlink (DL) and uplink (UL) each of 0.5 ms or less, or round trip 1 ms or less
  • the antenna module 197 may transmit or receive signals or power to the outside (eg, an external electronic device).
  • the antenna module 197 may include an antenna including a radiator formed of a conductor or a conductive pattern formed on a substrate (eg, PCB).
  • the antenna module 197 may include a plurality of antennas (eg, an array antenna). In this case, at least one antenna suitable for a communication method used in a communication network such as the first network 198 or the second network 199 is selected from the plurality of antennas by the communication module 190, for example. can be chosen A signal or power may be transmitted or received between the communication module 190 and an external electronic device through the selected at least one antenna.
  • other components eg, a radio frequency integrated circuit (RFIC) may be additionally formed as a part of the antenna module 197 in addition to the radiator.
  • RFIC radio frequency integrated circuit
  • the antenna module 197 may form a mmWave antenna module.
  • the mmWave antenna module includes a printed circuit board, an RFIC disposed on or adjacent to a first surface (eg, a lower surface) of the printed circuit board and capable of supporting a designated high frequency band (eg, mmWave band); and a plurality of antennas (eg, array antennas) disposed on or adjacent to a second surface (eg, a top surface or a side surface) of the printed circuit board and capable of transmitting or receiving signals of the designated high frequency band. can do.
  • peripheral devices eg, a bus, general purpose input and output (GPIO), serial peripheral interface (SPI), or mobile industry processor interface (MIPI)
  • signal e.g. commands or data
  • commands or data may be transmitted or received between the electronic device 101 and the external electronic device 104 through the server 108 connected to the second network 199 .
  • Each of the external electronic devices 102 or 104 may be the same as or different from the electronic device 101 .
  • all or part of operations executed in the electronic device 101 may be executed in one or more external electronic devices among the external electronic devices 102 , 104 , or 108 .
  • the electronic device 101 when the electronic device 101 needs to perform a certain function or service automatically or in response to a request from a user or another device, the electronic device 101 instead of executing the function or service by itself.
  • one or more external electronic devices may be requested to perform the function or at least part of the service.
  • One or more external electronic devices receiving the request may execute at least a part of the requested function or service or an additional function or service related to the request, and deliver the execution result to the electronic device 101 .
  • the electronic device 101 may provide the result as at least part of a response to the request as it is or additionally processed.
  • cloud computing distributed computing, mobile edge computing (MEC), or client-server computing technology may be used.
  • the electronic device 101 may provide an ultra-low latency service using, for example, distributed computing or mobile edge computing.
  • the external electronic device 104 may include an internet of things (IoT) device.
  • Server 108 may be an intelligent server using machine learning and/or neural networks. According to one embodiment, the external electronic device 104 or server 108 may be included in the second network 199 .
  • the electronic device 101 may be applied to intelligent services (eg, smart home, smart city, smart car, or health care) based on 5G communication technology and IoT-related technology.
  • FIG. 2 is a block diagram illustrating a program according to one embodiment of the present disclosure.
  • a block diagram 200 illustrates a program 140 according to one embodiment.
  • the program 140 includes an operating system 142, middleware 144, or an application 146 executable in the operating system 142 for controlling one or more resources of the electronic device 101.
  • the operating system 142 may include, for example, Android TM , iOS TM , Windows TM , Symbian TM , Tizen TM , or Bada TM .
  • At least some of the programs 140 are, for example, preloaded in the electronic device 101 at the time of manufacture, or when used by a user, an external electronic device (eg, the electronic device 102 or 104), or a server ( 108)) can be downloaded or updated.
  • the operating system 142 may control management (eg, allocation or reclamation) of one or more system resources (eg, process, memory, or power) of the electronic device 101 .
  • Operating system 142 may additionally or alternatively include other hardware devices of electronic device 101 , such as input module 150 , sound output module 155 , display module 160 , audio module 170 . , sensor module 176, interface 177, haptic module 179, camera module 180, power management module 188, battery 189, communication module 190, subscriber identification module 196, or It may include one or more driver programs for driving the antenna module 197.
  • the middleware 144 may provide various functions to the application 146 so that the function or information provided from one or more resources of the electronic device 101 may be used by the application 146 .
  • the middleware 144 includes, for example, the application manager 201, the window manager 203, the multimedia manager 205, the resource manager 207, the power manager 209, the database manager 211, and the package manager 213. ), connectivity manager 215, notification manager 217, location manager 219, graphics manager 221, security manager 223, call manager 225, or voice recognition manager 227. can
  • the application manager 201 may manage the life cycle of the application 146 , for example.
  • the window manager 203 may manage one or more GUI resources used in a screen, for example.
  • the multimedia manager 205 identifies, for example, one or more formats necessary for reproducing media files, and encodes or decodes a corresponding media file among the media files using a codec suitable for the selected format. can be done
  • the resource manager 207 may manage a source code of the application 146 or a memory space of the memory 130 .
  • the power manager 209 may manage, for example, the capacity, temperature, or power of the battery 189, and determine or provide related information necessary for the operation of the electronic device 101 by using corresponding information among them. . According to an embodiment, the power manager 209 may interoperate with a basic input/output system (BIOS) (not shown) of the electronic device 101 .
  • BIOS basic input/output system
  • the database manager 211 may create, search, or change a database to be used by the application 146, for example.
  • the package manager 213 may manage installation or update of applications distributed in the form of package files, for example.
  • the connectivity manager 215 may manage, for example, a wireless connection or a direct connection between the electronic device 101 and an external electronic device.
  • the notification manager 217 may provide a function for notifying a user of occurrence of a designated event (eg, an incoming call, message, or alarm), for example.
  • the location manager 219 may manage location information of the electronic device 101, for example.
  • the graphic manager 221 may manage, for example, one or more graphic effects to be provided to a user or a user interface related thereto.
  • Security manager 223 may provide system security or user authentication, for example.
  • the telephony manager 225 may manage, for example, a voice call function or a video call function provided by the electronic device 101 .
  • the voice recognition manager 227 transmits, for example, the user's voice data to the server 108, and at least partially based on the voice data, a command corresponding to a function to be performed in the electronic device 101; Alternatively, text data converted at least partially based on the voice data may be received from the server 108 .
  • the middleware 244 may dynamically delete some existing components or add new components.
  • at least part of the middleware 144 may be included as part of the operating system 142 or may be implemented as separate software different from the operating system 142 .
  • the application 146 includes, for example, a home 251, a dialer 253, an SMS/MMS 255, an instant message (IM) 257, a browser 259, a camera 261, and an alarm 263. , Contacts (265), Voice Recognition (267), Email (269), Calendar (271), Media Player (273), Albums (275), Watch (277), Health (279) (e.g. exercise or blood sugar) measurement of biometric information) or environmental information 281 (eg, measurement of atmospheric pressure, humidity, or temperature information). According to an embodiment, the application 146 may further include an information exchange application (not shown) capable of supporting information exchange between the electronic device 101 and an external electronic device.
  • an information exchange application not shown
  • the information exchange application may include, for example, a notification relay application configured to transmit designated information (eg, a call, message, or alarm) to an external electronic device, or a device management application configured to manage an external electronic device.
  • the notification relay application for example, transmits notification information corresponding to a designated event (eg, mail reception) generated in another application (eg, the email application 269) of the electronic device 101 to an external electronic device.
  • the notification relay application may receive notification information from an external electronic device and provide the notification information to the user of the electronic device 101 .
  • the device management application is, for example, a power source (eg, turn-on or turn-off) of an external electronic device that communicates with the electronic device 101 or some component thereof (eg, a display module or a camera module of the external electronic device). ) or functions (eg brightness, resolution, or focus).
  • the device management application may additionally or alternatively support installation, deletion, or update of an application operating in an external electronic device.
  • Electronic devices may be devices of various types.
  • the electronic device may include, for example, a portable communication device (eg, a smart phone), a computer device, a portable multimedia device, a portable medical device, a camera, a wearable device, or a home appliance.
  • a portable communication device eg, a smart phone
  • a computer device e.g., a smart phone
  • a portable multimedia device e.g., a portable medical device
  • a camera e.g., a portable medical device
  • a camera e.g., a portable medical device
  • a camera e.g., a portable medical device
  • a camera e.g., a camera
  • a wearable device e.g., a smart bracelet
  • first, second, or first or secondary may simply be used to distinguish that component from other corresponding components, and may refer to that component in other respects (eg, importance or order) is not limited.
  • a (eg, first) component is said to be “coupled” or “connected” to another (eg, second) component, with or without the terms “functionally” or “communicatively.”
  • the certain component may be connected to the other component directly (eg by wire), wirelessly, or through a third component.
  • module used in various embodiments of this document may include a unit implemented in hardware, software, or firmware, and is interchangeable with terms such as, for example, logic, logical blocks, parts, or circuits.
  • a module may be an integrally constructed component or a minimal unit of components or a portion thereof that performs one or more functions.
  • the module may be implemented in the form of an application-specific integrated circuit (ASIC).
  • ASIC application-specific integrated circuit
  • a storage medium eg, internal memory 136 or external memory 138
  • a machine eg, electronic device 101
  • a processor eg, the processor 120
  • a device eg, the electronic device 101
  • the one or more instructions may include code generated by a compiler or code executable by an interpreter.
  • the device-readable storage medium may be provided in the form of a non-transitory storage medium.
  • the storage medium is a tangible device and does not contain a signal (e.g. electromagnetic wave), and this term refers to the case where data is stored semi-permanently in the storage medium. It does not discriminate when it is temporarily stored.
  • a signal e.g. electromagnetic wave
  • the method according to various embodiments disclosed in this document may be included and provided in a computer program product.
  • Computer program products may be traded between sellers and buyers as commodities.
  • a computer program product is distributed in the form of a device-readable storage medium (e.g. compact disc read only memory (CD-ROM)), or through an application store (e.g. Play StoreTM) or on two user devices (e.g. It can be distributed (eg downloaded or uploaded) online, directly between smart phones.
  • a device-readable storage medium e.g. compact disc read only memory (CD-ROM)
  • an application store e.g. Play StoreTM
  • two user devices e.g. It can be distributed (eg downloaded or uploaded) online, directly between smart phones.
  • at least part of the computer program product may be temporarily stored or temporarily created in a device-readable storage medium such as a manufacturer's server, an application store server, or a relay server's memory.
  • each component (eg, module or program) of the above-described components may include a single object or a plurality of entities, and some of the plurality of entities may be separately disposed in other components. there is.
  • one or more components or operations among the aforementioned corresponding components may be omitted, or one or more other components or operations may be added.
  • a plurality of components eg modules or programs
  • the integrated component may perform one or more functions of each of the plurality of components identically or similarly to those performed by a corresponding component of the plurality of components prior to the integration. .
  • the actions performed by a module, program, or other component are executed sequentially, in parallel, iteratively, or heuristically, or one or more of the actions are executed in a different order, or omitted. or one or more other actions may be added.
  • FIG. 3 is a diagram for explaining an operation related to a database stored in an electronic device according to an embodiment of the present disclosure.
  • the electronic device 101 may correspond to at least one of a smart phone, a smart pad, a tablet PC, a personal digital assistance (PDA), a laptop PC, or a desktop PC.
  • the electronic device 101 may be accessory type (e.g. watch, ring, bracelet, anklet, necklace, glasses, contact lens, or head-mounted-device (HMD)), textile or clothing integrated (e.g. electronic device).
  • the electronic device 101 may correspond to a wearable device including at least one of a clothing), a body attachment type (eg, a skin pad or tattoo), or a living body implantable type (eg, an implantable circuit).
  • the electronic device 101 may be home appliances such as a refrigerator, a television (TV), a vacuum cleaner, an air conditioner, a washing machine, and a lighting device
  • the electronic device 101 includes a processor 120, a memory 130, and a display module 160 )
  • the electronic device 101 may be at least partially the same as the electronic device 101 illustrated in FIG. 1 .
  • processor 120 may execute one or more instructions stored in memory 130 .
  • the processor 120 may include at least one of a circuit for processing data, for example, an Integrated Circuit (IC), an Arithmetic Logic Unit (ALU), a Field Programmable Gate Array (FPGA), and a Large-Scale Integration (LSI).
  • IC Integrated Circuit
  • ALU Arithmetic Logic Unit
  • FPGA Field Programmable Gate Array
  • LSI Large-Scale Integration
  • the memory 130 may store data related to the electronic device 101 .
  • the memory 130 includes volatile memory 132 such as random access memory (RAM) including static random access memory (SRAM) or dynamic RAM (DRAM), etc., or read only memory (ROM), magnetic RAM (MRAM).
  • RAM random access memory
  • SRAM static random access memory
  • DRAM dynamic RAM
  • MRAM magnetic RAM
  • the non-volatile memory 134 may have a form of an internal memory 136 included in the electronic device 101 and/or a form of an external memory 138 detachable to the electronic device 101 .
  • the memory 130 may store instructions related to the application 146 and instructions related to an operating system (eg, the operating system 142 of FIG. 1 ).
  • the operating system may be system software executed by processor 120 .
  • the processor 120 may manage hardware components (eg, the memory 130 of FIG. 1 to the antenna module 197 of FIG. 1 ) included in the electronic device 101 by executing an operating system.
  • the operating system may provide an application programming interface (API) to the application 146, which is software other than system software.
  • API application programming interface
  • one or more applications 146 which are sets of a plurality of instructions, may be installed in the memory 130. That the application 146 is installed in the memory 130 may mean that the application 146 is stored in a format executable by the processor 120 connected to the memory 130 .
  • the display module 160 may visually output information to a user using at least one of Organic Light Emitting Diodes (OLED), Liquid Crystal Display (LCD), and Light Emitting Diodes (LED).
  • OLED Organic Light Emitting Diodes
  • LCD Liquid Crystal Display
  • LED Light Emitting Diodes
  • the electronic device 101 is a touch sensor panel (Touch Screen Panel, TSP) disposed on the display module 160 (not shown) may be included.
  • the touch sensor panels touch the display module 160 or display devices 160 using at least one of a resistive film, capacitive components, surface acoustic waves, and infrared rays. ), the position of an object (eg, a user's finger or a stylus) hovering above may be detected.
  • the program 140 may include a database manager 211 and/or a database library 310 that provides functions for processing data between the application 146 and the database 330 .
  • the DB library 310 may be included in middleware (eg, middleware 144 of FIGS. 1 and 2).
  • the middleware may provide various functions to the application 146 so that the function or information provided from one or more resources of the electronic device 101, such as the database 330, may be used by the application 146.
  • the electronic device 101 may create, search, or change the database 330 by the application 146 based on the database manager 211 and/or the DB library 310 .
  • the DB library 310 manages modified data of the database 330 based on the application 146, and detects and restores errors related to data modification. and a recovery manager 315 .
  • the electronic device 101 may access data included in the database 330 through the file system 320 (may access).
  • the electronic device 101 guarantees the consistency and/or integrity of the data based on the data log and recovery manager 315. can do.
  • the electronic device 101 may manage data stored in storage based on the file system 320, for example, the non-volatile memory 134.
  • the electronic device 101 may use the file system 320 to manage a location where data (eg, a file) of the database 330 is stored.
  • File system 320 may be included in an operating system.
  • the electronic device 101 may set at least a portion of the volatile memory 132 and/or the non-volatile memory 134 of the memory 130 as storage.
  • the storage may correspond to a storage area in which data related to the electronic device 101 is preserved.
  • the memory may refer to a portion of the volatile memory 132 and/or the non-volatile memory 134 that is distinct from the storage area.
  • the memory may correspond to a work area for processing data related to the electronic device 101 .
  • the electronic device 101 may manage data related to the application 146 based on the database 330 .
  • the database 330 is a set of organized data and may mean a set of data stored in storage based on a designated list or data structure. Almost all applications and services installed in the electronic device 101 may operate based on the database 330 . In this case, while the electronic device 101 is operating, access to the database 330 by a plurality of different applications and services may occur frequently.
  • the number of databases 330 stored in the storage of the electronic device 101 is not limited to the embodiment shown in FIG. 3 and may be plural.
  • Atomicity of transactions related to the database 330 may be guaranteed. Atomicity may mean that a result of calculating data of the database 330 based on all operations included in one transaction is all or not reflected in the database 330 .
  • a corresponding transaction may mean a unit of operation performed to change the state of the database 330 .
  • a transaction is a logical unit of work (LUW) of operations related to data in the database 330, which may be a unit of interaction between the application 146 and the database 330.
  • An operation related to data of the database 330 means an operation of accessing the database 330 based on a structured query language (SQL) such as, for example, OPEN, SELECT, INSERT, DELETE, UPDATE, CLOSE. can do.
  • SQL structured query language
  • one transaction may refer to a set of one or more actions and/or queries related to data in the database 330 .
  • an operation included in a transaction and related to data of the database 330 may include an operation of reading data, an operation of adding data, an operation of deleting data, and an operation of changing data.
  • the commit of a transaction may mean that all operations related to data included in the transaction have been successfully performed.
  • the electronic device 101 may guarantee the integrity and atomicity of data in the database 330 based on the database manager 211 and/or the data log and recovery manager 315 .
  • the electronic device 101 can guarantee the integrity and atomicity of data in the database 330 by managing changed data in the database 330 based on a journal method.
  • the journal method may include a write-ahead logging (WAL) method and/or a roll-back method.
  • WAL write-ahead logging
  • the electronic device 101 may include a database 330 based on SQLite.
  • the electronic device 101 can guarantee atomicity of a transaction by accessing the SQLite-based database 330 according to the WAL method.
  • FIG. 4 is a diagram for explaining an operation of restoring damage to a database according to an embodiment of the present disclosure.
  • the electronic device may include a first memory, a second memory, and a processor (eg, the processor 120 of FIGS. 1 and 3 ).
  • the first memory is a non-volatile memory (eg, the non-volatile memory 134 of FIGS. 1 and 3 ) and may be a large-capacity storage device.
  • the first memory may include at least one of one time programmable ROM (OTPROM), PROM, EPROM, EEPROM, mask ROM, flash ROM, flash memory, hard drive, or solid state drive (SSD).
  • OTPROM time programmable ROM
  • PROM PROM
  • EPROM EPROM
  • EEPROM electrically erasable programmable ROM
  • the first memory may store a database including various data, and the database may be updated by a transaction according to an operation of a processor.
  • the second memory may be a volatile memory having properties different from those of the first memory (eg, the volatile memory 132 of FIGS. 1 and 3 ). According to various embodiments, at least some area of the second memory is allocated as a main memory, the processor loads or temporarily stores data of the first memory in the second memory, and temporarily stores data in the second memory. You can perform transactional operations on data.
  • the processor may store, in the second memory, journal data including an operation result of the transaction and meta data indicating an address of data to which the transaction is to be reflected.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 410 to 480 may be performed by at least one component of the electronic device (eg, the processor 120 of FIGS. 1 and 3 ).
  • the electronic device may open a database or perform a query operation.
  • the database may be corrupt and open or query operations may not be completed
  • Corrupted databases can be caused by a variety of causes, such as faulty hardware, errors in applications or runtime libraries
  • Corruption in databases can occur in the database engine (e.g. libsqlite.so)
  • a corruption event may be received by the database framework, and actions 420 to 450 may be performed when corruption of the database is detected.
  • the electronic device may perform an advanced integrity verification based recovery operation.
  • the electronic device at least a portion of the database is loaded into the user area of the second memory).
  • the recovery operation may be performed by sequentially initializing the DB cache and the OS cache loaded into the kernel area of the second memory, respectively, and then performing the integrity check of the database. 6. If the recovery operation based on advanced integrity verification succeeds, the electronic device may open a database or perform a query operation in operation 460. Conversely, the recovery operation based on advanced integrity verification fails. If so, operation 430 may then be performed.
  • the electronic device may perform a backup metadata recovery operation.
  • the electronic device responds to corruption of metadata loaded into the DB cache by restoring metadata.
  • a recovery operation can be performed by performing metadata override based on backup data on the DB cache.
  • the backup metadata recovery operation will be described in detail with reference to Figures 7 to 10. If the backup metadata recovery operation succeeds, 460) is then performed, and conversely, if the backup metadata recovery operation fails, operation 440 may be subsequently performed.
  • the electronic device may perform a template recovery operation.
  • the electronic device loads template data for metadata into a DB cache, and based on the template data Metadata may be restored through in-place update.
  • In-place update may indicate that metadata stored in the DB cache is directly updated in the DB cache based on template data. and Fig. 12. If the template recovery operation succeeds, operation 460 may be subsequently performed, and conversely, if the template recovery operation fails, operation 450 may be subsequently performed.
  • the electronic device may perform other recovery operations.
  • the electronic device may perform ReIndex and/or VACUUM, or a table page calling module of the database management system.
  • ReIndex may indicate an operation of recreating an index based on a schema
  • the table page call module is a module that calls a page of a specific table of the database management system, for example For example, it may be DBdata of SQLite
  • Other recovery operations will be described in detail with reference to Fig. 13. If the other recovery operations succeed, operation 460 is subsequently performed, and conversely, if other recovery operations fail, operation 460 is performed. may be performed subsequently.
  • the electronic device may initialize the database that has failed to recover. If initialization is performed, user data stored in the database may be lost. Due to the loss, Since important user data such as contacts, messages, and notes may be deleted, a multi-step runtime recovery technique may be provided to prevent the database from being initialized.
  • the electronic device may perform a corruption error report.
  • the corruption error report may indicate whether database corruption was found while performing any operation. , results of execution of various stages of runtime recovery techniques, and various information on database initialization operations without limitation.
  • the corruption error report may indicate that the above-described information is delivered to the application that requested DB open or query operation execution. .
  • 5 and 6 are diagrams for explaining an advanced integrity verification based recovery operation according to various embodiments of the present disclosure.
  • an electronic device may perform a recovery operation by determining whether a memory is damaged and performing integrity verification.
  • a database management system e.g., SQLite
  • a database management system itself uses a structure memory for page cache and DB operation, and corruption of the database (e.g., database 330 in FIG. 3) may be detected due to damage to the corresponding memory.
  • the database itself stored in the first memory may be normal, but the DB cache and/or the OS cache loaded with at least a part of the database to open the database and/or perform a query may be damaged.
  • the DB cache may be a cache in which at least a portion of the database is loaded into a user area
  • the OS cache may be a cache in which at least a portion of the database is loaded into a kernel area.
  • the electronic device may recover memory damage by performing an operation 510 of initializing the DB cache or an OS cache and an operation 530 of checking integrity of the database.
  • the DB cache and the OS cache load at least a part of a database for which an open or query operation is requested, and operation layers may be different from each other.
  • the OS cache may include a kernel page cache of a database and metadata of a file system (eg, file system 320 of FIG. 3 ).
  • the DB cache may be a cache in which at least a portion of the database is loaded into a user area of the second memory, and the OS cache may be a cache in which at least a portion of the database is loaded into a kernel area of the second memory.
  • the database shown in FIG. 5 may be stored in the first memory.
  • the electronic device may determine whether memory damage has been repaired through integrity check.
  • FIG. 6 illustrates an advanced integrity verification-based recovery operation performed in an electronic device (eg, the electronic device 101 of FIGS. 1 and 3 ) according to an embodiment of the present disclosure.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 610 to 640 may be performed by at least one component (eg, the processor 120 of FIGS. 1 and 3 ) of the electronic device.
  • an electronic device may initialize a DB cache. For example, the electronic device clears data loaded into the DB cache. (clear) and load at least a part of the database (eg, the database 330 of Fig. 3) At this time, the electronic device closes and reopens the connection to the database, or cleans all internal caches of the database. The electronic device can create a new database connection when all internal caches are cleared.
  • the electronic device may initialize the DB cache and then check the integrity of the database. For example, after initializing the DB cache, check the integrity of the database. and if the consistency check succeeds, the integrity check of the database can be performed.
  • Consistency check can be performed in various forms. For example, the electronic device may re-perform the query in which the database corruption is detected to check whether the query result is normally answered. When a normal query result is answered, the electronic device may determine that the consistency check is successful. Alternatively, when database damage is detected as failure to open the database, the electronic device may open the database again, and if the open is normally executed, it may be determined that the consistency check is successful.
  • the electronic device may perform integrity check of the database. For example, if the database management system is SQLite, the electronic device may check the integrity of the database through the SQL statement [PRAGMA integrity_check(1);]. If the integrity check of the database succeeds, it may be determined that the memory corruption is repaired and the database corruption is also resolved.
  • the electronic device may assume that a part other than the DB cache is damaged and then perform operation 630 .
  • the electronic device may initialize the OS cache. For example, the electronic device may clear data loaded in the OS cache and again at least a portion of the database. Since the content described in operation 610 can be applied to the cache initialization operation in the same way, further details are omitted.
  • the electronic device may initialize the OS cache and then check the integrity of the database. For example, after initializing the OS cache, check the integrity of the database. , and if the consistency check is successful, the integrity check of the database may be performed Since the contents described in operation 630 may be similarly applied to the consistency check and the integrity check operation of the database, further details are omitted.
  • both the consistency check and the integrity check of the database succeed after initializing the OS cache, it may be determined that the memory corruption is repaired and the database corruption is also resolved. Conversely, if the database consistency check fails or the database integrity check fails, it may be determined that the integrity verification based recovery has failed.
  • FIGS 7 to 10 are diagrams for explaining backup metadata recovery operations according to various embodiments of the present disclosure.
  • an electronic device may perform a backup metadata recovery operation when the previously described advanced integrity verification-based recovery operation fails.
  • the electronic device may restore a database (eg, the database 330 of FIG. 3 ) by performing memory overriding using metadata previously backed up before being damaged.
  • the electronic device detects corruption of metadata loaded into the DB cache (710), performs integrity check of the backup data if backup data exists (720), and overrides metadata based on the backup data to the DB cache.
  • An operation 730 to perform and an operation 740 to reflect the metadata loaded in the DB cache to the on-disk may be performed.
  • FIG. 8 illustrates an operation of creating metadata backup data performed in an electronic device (eg, the electronic device 101 of FIGS. 1 and 3 ) according to an embodiment of the present disclosure.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 810 to 850 may be performed by at least one component of the electronic device (eg, the processor 120 of FIGS. 1 and 3 ).
  • the electronic device performs a database (eg, the database of FIG. 3 ( ) according to a user request or a system request. 330)) Write transactions can be performed.
  • a database eg, the database of FIG. 3 ( ) according to a user request or a system request. 330
  • the electronic device may determine whether metadata is updated in the write transaction.
  • the metadata is important metadata such as a database header and a database schema). If the metadata is updated then operation 830 may be performed, conversely if the metadata is not updated then operation 840 may be performed.
  • the electronic device may additionally create metadata backup data.
  • the backup data may be used for metadata override performed later.
  • the electronic device e.g., database management system
  • the electronic device may roll back the metadata's backup data to a previous state.
  • the backup metadata also You can go back to a previous state, which allows the backup metadata to remain the same as the current database metadata.
  • FIG. 9 illustrates a metadata overriding operation performed in an electronic device (eg, the electronic device 101 of FIGS. 1 and 3 ) according to an embodiment of the present disclosure.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 910 to 940 may be performed by at least one component (eg, the processor 120 of FIGS. 1 and 3 ) of the electronic device.
  • operation 910 when the electronic device (processor 120 (eg, database management system) determines that metadata in the DB cache is damaged, it determines whether backup data of the corresponding metadata exists). If metadata backup data does not exist, the backup metadata recovery operation may be terminated, and if metadata backup data exists, operation 920 may be subsequently performed.
  • processor 120 eg, database management system
  • the electronic device may perform integrity check of the backup data. For example, the electronic device may perform consistency check of the backup data, and check consistency. If this succeeds, integrity verification of the backup data can be performed. For example, if the backup data is written as a separate file, consistency verification can be performed according to the checksum method. Since the previous descriptions may be applied similarly to , a detailed description thereof will be omitted. If both the consistency check and the integrity check of the metadata are successful, operation 930 is subsequently performed, and otherwise, the backup metadata recovery operation may be terminated. .
  • integrity check of the backup data For example, the electronic device may perform consistency check of the backup data, and check consistency. If this succeeds, integrity verification of the backup data can be performed. For example, if the backup data is written as a separate file, consistency verification can be performed according to the checksum method. Since the previous descriptions may be applied similarly to , a detailed description thereof will be omitted. If both the consistency check and the integrity check of the metadata are successful, operation 930 is subsequently performed, and otherwise, the backup
  • the electronic device may load backup data into in-memory, which may be referred to as a metadata overriding technique.
  • Backup data may be loaded in-memory).
  • Loading into the memory may indicate that the backup data is loaded into the DB cache
  • the electronic device may load the backup data stored in the non-volatile memory (eg, the non-volatile memory 134 of FIGS. 1 and 3) into the DB cache.
  • the electronic device may load the backup data stored in the non-volatile memory (eg, the non-volatile memory 134 of FIGS. 1 and 3) into the DB cache.
  • metadata override metadata can be extracted from backup data and used as runtime by loading the database header or database schema.
  • Operation 940 may then be performed if metadata overriding is successfully performed, otherwise the backup metadata recovery operation may be terminated.
  • an operation of reading data stored in the first memory can be normally performed even though it is impossible to change or add data to the database (eg, the database 330 of FIG. 3 ). This allows read-only database connections to be used.
  • an operation 940 of restoring a currently damaged database may be performed.
  • the electronic device may perform database recovery using the backup data.
  • the electronic device may perform database recovery based on the in-place update. And, this will be described in detail with reference to FIG. 10 .
  • FIG. 10 illustrates an in-place update operation of metadata using backup data performed in an electronic device (eg, the electronic device 101 of FIGS. 1 and 3 ) according to an embodiment of the present disclosure.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 1010 to 1030 may be performed by at least one component of the electronic device (eg, the processor 120 of FIGS. 1 and 3 ).
  • an electronic device may acquire an exclusive lock to perform an in-place update.
  • the exclusive lock is a connection of another database).
  • Exclusive locks can be locks that prevent all reads and writes from being used.
  • the electronic device may perform metadata update through in-place update in a state in which an exclusive lock has been acquired.
  • In-place update may perform a database ( Example: This may be a task of rewriting normal metadata extracted from backup data in the same location of the corrupted metadata in the database 330 of Fig. 3. Through this in-place update, database corruption can be resolved. .
  • the electronic device may return an exclusive lock when the in-place update is completed.
  • 11 and 12 are views for explaining a template recovery operation according to various embodiments of the present disclosure.
  • an electronic device may perform a template recovery operation when the aforementioned backup metadata recovery operation fails.
  • a template recovery operation may be performed when a backup metadata recovery operation fails, such as when metadata backup data does not exist or metadata integrity verification fails.
  • a header (eg, a database header and a page header) of a database may have a predefined file format.
  • the electronic device may generate a template suitable for the state of the database or page using the corresponding file format and attempt to determine whether the database can be restored.
  • the electronic device may perform an operation 1110 of performing template overriding based on template data for metadata in the DB cache and an operation 1120 of performing integrity check of the template data loaded in the DB cache. If the integrity of the template data is successfully verified, the electronic device may restore the database by reflecting the template data loaded in the DB cache based on the in-place update to the database stored in the first memory.
  • FIG. 12 illustrates a template recovery operation performed in an electronic device (eg, the electronic device 101 of FIGS. 1 and 3 ) according to an embodiment of the present disclosure.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 1210 to 1260 may be performed by at least one component (eg, the processor 120 of FIGS. 1 and 3 ) of the electronic device.
  • an electronic device may determine at run time whether a database header or a database page header is damaged. Database header If corruption exists, operation 1220 may then be performed, conversely if there is no corruption of the database header, operation 1240 may then be performed.
  • the electronic device may determine the state of the database (eg, the database 330 of FIG. 3). For example, the electronic device determines the size of the database. can be checked as a file size, and the journal mode can be determined by the presence or absence of a WAL file The electronic device applies information that cannot be determined in the current file state as basic header data to determine whether the corresponding file can operate normally. can
  • the electronic device may generate template data for header data of the database based on the database state.
  • the electronic device checks the integrity of the generated template data. , and if the integrity of the template data is successfully checked, the database can be restored by reflecting it to the database through an in-place update.
  • the electronic device may determine at run time whether page header corruption exists. If there is page header corruption, operation 1250 continues. and, conversely, if there is no damage to the page header, it may be determined that the template recovery operation has failed.
  • the electronic device may determine a page state. For example, the electronic device may check information about a page type and a parent page). The electronic device may determine whether the corresponding file can operate normally by applying information that cannot be determined in the current page state as basic header data.
  • the electronic device may generate template data for header data of the page based on the page state.
  • the electronic device checks the integrity of the generated template data. , and if the integrity of the template data is successfully checked, the database can be restored by reflecting it to the database through an in-place update.
  • the electronic device may sequentially determine whether the database header and the page header are damaged, thereby generating template data suitable for each header and utilizing the data for database recovery.
  • FIG. 13 is a diagram for explaining other recovery operations according to an embodiment of the present disclosure.
  • the electronic device may perform other recovery operations when the aforementioned template recovery operation fails.
  • each operation may be performed sequentially, but not necessarily sequentially.
  • the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 1310 to 1380 may be performed by at least one component (eg, the processor 120 of FIGS. 1 and 3 ) of the electronic device.
  • the electronic device may determine whether or not the database (eg, the database 330 of FIG. 3) is normally opened. Recovery described above If all of the operations fail, the electronic device may attempt to recover the database using various techniques provided by the database management system (e.g., SQLite.) These techniques may be used to ensure that the database connection is normally open and that query operations can be performed. status, it can be determined in advance whether the database is normally opened.
  • the database management system e.g., SQLite.
  • the electronic device may determine whether an index of the database is damaged. If it is determined that the index of the database is damaged, operation 1330 Conversely, if the index of the database is not corrupted, operation 1340 may be subsequently performed.
  • the electronic device may perform reindexing on the database. Reindexing may invalidate the current index and create a new index).
  • the electronic device may determine whether a freelist or table tree map for the database is damaged. Freelist or table tree If the map is corrupted, then operation 1360 may be performed, otherwise operation 1350 may be followed, where the free list may indicate a list of unused pages in the database. This indicates mapping information for managing a tree, and may be, for example, a SQLite ptr map entry.
  • the electronic device may determine whether the unused page is damaged. If the unused page is damaged, operation 1360 is subsequently performed, If not, operation 1370 may then be performed.
  • the electronic device may perform VACUUM on the database.
  • VACUUM eg, database management system
  • the contents of the database are moved once to a temporary database and then back again. Processing can be performed, thereby removing empty space and at the same time reconstructing the database by sequentially storing data.
  • the electronic device extracts data from the database based on the table page call module of the database management system.
  • the table page call module is a technique using the virtual table function provided by the database management system, and may be a function that parses records of each page and delivers them as query results, for example, DBdata of SQLite. can be
  • the electronic device may create a new database based on the extracted data. For example, the electronic device may perform an insert after querying). You can create a new database.
  • FIG. 14 is a diagram illustrating an operating method of an electronic device according to an embodiment of the present disclosure.
  • each operation may be performed sequentially, but not necessarily sequentially. For example, the order of each operation may be changed, or at least two operations may be performed in parallel.
  • Operations 1410 to 1440 are performed by at least one component (eg, processor 120 of FIGS. 1 and 3 ) of an electronic device (eg, electronic device 101 of FIGS. 1 and 3 ). It can be.
  • the electronic device determines whether a database (eg, database 330 of FIG. 3) stored in a non-volatile first memory is damaged. can judge whether a database (eg, database 330 of FIG. 3) stored in a non-volatile first memory is damaged. can judge whether a database (eg, database 330 of FIG. 3) stored in a non-volatile first memory is damaged. can judge whether a database (eg, database 330 of FIG. 3) stored in a non-volatile first memory is damaged. can judge
  • the electronic device eg, the database management system
  • the electronic device initializes a DB cache into which at least a portion of the database is loaded, and then performs a first integrity check of the database.
  • the electronic device eg, the database management system
  • the electronic device initializes the OS cache in which at least a part of the database is loaded, and then the second integrity check of the database can be performed.
  • the electronic device may perform a database operation if the first integrity check or the second integrity check of the database succeeds.
  • a method of operating an electronic device includes an operation of determining whether a database stored in a non-volatile first memory of the electronic device is damaged, and if it is determined that the database is damaged, at least a portion of the database is stored in a user area of the second memory. After initializing the DB cache loaded with the operation of performing the first integrity check of the database, if the first integrity check of the database fails, after initializing the OS cache in which at least a part of the database is loaded into the kernel area of the second memory An operation of performing the second integrity check of the database and, if the first integrity check or the second integrity check of the database succeeds, an operation of performing an operation on the database file.
  • the operation of performing the first integrity check of the database in the operating method of the electronic device may perform the first consistency check of the database, and if the first consistency check succeeds, the first integrity check of the database may be performed. there is.
  • the operation of performing the first integrity check of the database in the operating method of the electronic device is performed by clearing the DB cache and then reloading at least a part of the database in response to detecting corruption, thereby cleaning the DB cache. can be initialized.
  • the operating method of the electronic device includes an operation of determining whether metadata loaded in a DB cache is damaged when the second integrity check of the database fails, and backup data of the metadata when it is determined that the metadata is damaged.
  • An operation of performing metadata overriding based on the DB cache may be further included.
  • the operation of overriding metadata in the DB cache in the operating method of the electronic device includes, when it is determined that the metadata is damaged, an operation of determining whether or not backup data of the metadata exists, and the existence of backup data. , performing the third integrity check of the backup data, and if the third integrity check of the backup data succeeds, loading the backup data into the DB cache and performing an in-place update based on the backup data. It may include an operation of recovering metadata through
  • an in-place update in an operating method of an electronic device is performed by rewriting metadata extracted from backup data in the same location of corrupted metadata in a state in which an exclusive lock on the database is acquired. and the exclusive lock can be returned when the in-place update is complete.
  • backup data in the operating method of an electronic device, includes an operation of determining whether metadata is updated when performing a write transaction for a database, and an operation of generating backup data for the metadata if the metadata is updated. and if creation of the backup data fails, it may be determined based on an operation of rolling back the backup data to a previous state.
  • a method of operating an electronic device includes an operation of loading template data for metadata into a DB cache and the template data when metadata backup data does not exist or the third integrity check of metadata fails. An operation of restoring metadata through an in-place update based on the above may be further included.
  • 15 is a diagram illustrating an electronic device according to an embodiment of the present disclosure.
  • an electronic device 1500 (eg, the electronic device 101 of FIGS. 1 and 3 ) according to an embodiment includes a first memory 1510, a second memory 1520, and a processor 1530. (eg, the processor 120 of FIGS. 1 and 3).
  • the electronic device 1500 may be implemented as a user terminal.
  • the user terminal may include various computing devices such as mobile phones, smart phones, tablets, laptops, personal computers, or e-book devices, various wearable devices such as smart watches, smart glasses, Head-Mounted Displays (HMDs), or smart clothes.
  • the device may include various home appliances such as a smart speaker, a smart TV, or a smart refrigerator, a smart car, a smart kiosk, an Internet of Things (IoT) device, a walking assist device (WAD), a drone, or a robot.
  • IoT Internet of Things
  • WAD walking assist device
  • the first memory 1510 is a non-volatile memory (eg, the non-volatile memory 134 of FIGS. 1 and 3 ) and may be a large-capacity storage device.
  • the first memory 1510 may store a database (eg, the database 330 of FIG. 3 ) including various data, and the database may be updated by a transaction according to the operation of the processor 1530 .
  • the second memory 1520 may be a volatile memory having properties different from those of the first memory 1510 (eg, the volatile memory 132 of FIGS. 1 and 3 ). According to various embodiments, at least a partial area of the second memory 1520 is allocated as a main memory, and the processor 1530 loads or loads data of the first memory 1510 into the second memory 1520. It is possible to temporarily store and perform a transactional operation on data temporarily stored in the second memory 1520 .
  • the processor 1530 determines whether the database is damaged, and if it is determined that the database is damaged, initializes a DB cache into which at least a part of the database is loaded, performs a first integrity check of the database, and fails the first integrity check of the database. After initializing the OS cache in which at least a part of the database is loaded, a second integrity check of the database is performed, and if the first integrity check or the second integrity check of the database succeeds, an operation on the database file may be performed.
  • the DB cache may be a cache in which at least a portion of the database is loaded into a user area of the second memory 1520
  • the OS cache may be a cache in which at least a portion of the database is loaded into a kernel area of the second memory 1520.
  • the electronic device 1500 may process the above-described operation.
  • the electronic device 1500 operates with a non-volatile first memory 1510 storing a database, a volatile second memory 1520, and the first memory 1510 and the second memory 1520. It may include a processor 1530 that is connected to the The processor 1530 determines whether the database is corrupted, and if it is determined that the database is corrupted, initializes a DB cache in which at least a portion of the database is loaded into the user area of the second memory 1520, and then A first integrity check of the database is performed, and if the first integrity check of the database fails, at least a portion of the database is loaded into the kernel area of the second memory 1520, and an operating system cache (operating system cache) is loaded. After initialization, a second integrity check of the database is performed, and if the first integrity check or the second integrity check of the database succeeds, a database file operation may be performed.
  • the processor 1530 initializes the DB cache and then performs a first consistency check of the database, and if the first consistency check succeeds, the first integrity check of the database verification can be performed.
  • the processor 1530 of the electronic device 1500 may initialize the DB cache by clearing the DB cache and then reloading at least a portion of the database in response to detection of corruption.
  • the processor 1530 determines whether the metadata loaded in the DB cache is damaged, and if it is determined that the metadata is damaged, the metadata Metadata overriding based on data's backup data can be performed on the DB cache.
  • the processor 1530 determines whether backup data of the metadata exists when it is determined that the metadata is damaged, and if the backup data exists, the third integrity of the backup data is determined. If the check is performed and the third integrity check of the backup data succeeds, the backup data is loaded into the DB cache, and metadata may be restored through an in-place update based on the backup data.
  • the in-place update in the electronic device 1500 is performed by rewriting metadata extracted from backup data in the same location of corrupted metadata in a state in which an exclusive lock on the database is acquired. and the exclusive lock can be returned when the in-place update is complete.
  • the backup data in the electronic device 1500 determines whether metadata is updated when performing a write transaction for the database, and if the metadata is updated, generating backup data for the metadata. and if creation of the backup data fails, it may be determined based on an operation of rolling back the backup data to a previous state.
  • the processor 1530 loads the template data for the metadata into the DB cache when backup data of the metadata does not exist or the third integrity check of the metadata fails. , Metadata can be restored through in-place update based on template data.
  • the processor 1530 determines whether the header data of the database is damaged when backup data of the metadata does not exist or the third integrity of the backup data fails, and If it is determined that the header data is damaged, template data for the header data of the database is created based on the state of the database, and if it is determined that the header data of the database is not damaged, whether or not the header data of the page in the database is damaged is determined. , When it is determined that the header data of the page is damaged, template data for the header data of the page may be generated based on the state of the page.
  • the processor 1530 determines whether the database is normally opened when metadata recovery fails based on the template data, and if the database is normally opened, the processor 1530 determines whether the database is normally opened. Determines whether the index of is damaged, if it is determined that the index of the database is damaged, performs a reindex on the database, and if it is determined that the index of the database is not damaged, the free list for the database ( determine whether the freelist) or table treemap is corrupted and/or whether unused pages are corrupted, and if it is determined that the freelist or table treemap is corrupted or the unused pages are corrupted, VACUUM is performed on the database.
  • the processor 1530 in the electronic device 1500 determines that the free list or table tree map is not damaged and unused pages are not damaged, the processor 1530 uses a table page calling module of the database management system. You can create a new database by extracting data from the database.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

데이터베이스를 복구하는 전자 장치 및 그 동작 방법이 개시된다. 개시된 전자 장치는 데이터베이스를 저장하는 비휘발성의 제1 메모리, 휘발성의 제2 메모리 및 제1 메모리 및 제2 메모리와 작동적으로 연결된 프로세서를 포함할 수 있다. 프로세서는 데이터베이스의 손상 여부를 판단하고, 데이터베이스가 손상된 것으로 판단되면, 데이터베이스의 적어도 일부가 제2 메모리의 사용자 영역으로 로딩된 DB 캐시를 초기화한 후 데이터베이스의 제1 무결성 확인을 수행하고, 데이터베이스의 제1 무결성 확인이 실패하면, 데이터베이스의 적어도 일부가 제2 메모리의 커널 영역으로 로딩된 OS 캐시를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행하고, 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면, 데이터베이스 파일에 대한 작업을 수행할 수 있다.

Description

데이터베이스를 복구하는 전자 장치 및 그 동작 방법
본 개시의 다양한 실시예들은 데이터베이스를 복구하는 전자 장치 및 그 동작 방법에 관한 것이다.
최근 디지털 기술의 발달과 함께 이동통신 단말기, 스마트폰(smart phone), 태블릿(tablet) PC(personal computer), 전자수첩, PDA(personal digital assistant), 웨어러블 장치(wearable device) 등과 같은 다양한 유형의 전자 장치가 널리 사용되고 있다. 전자 장치는 데이터베이스에 기반하여, 하나 이상의 어플리케이션, 서비스 및/또는 운영 체제의 데이터를 관리할 수 있다. 예를 들어, 전자 장치는 실행 중인 어플리케이션, 서비스 및/또는 운영 체제에 기반하여, 상기 데이터베이스의 데이터를 처리할 수 있다.
상기 정보는 본 개시 내용의 이해를 돕기 위한 배경 정보로만 제공된다. 상기 내용 중 어느 것이 본 개시와 관련하여 선행 기술로 적용될 수 있는지 여부에 대해, 어떤 결정도 내려지지 않았으며, 어떠한 주장도 이루어지지 않는다.
전자장치의 운용 중, 예기치 않은 시스템 혹은 하드웨어 오류나 어플리케이션 또는 런타임 라이브러리 오류와 같은 다양한 원인에 의해 데이터베이스 손상이 발생할 수 있다. 안드로이드 OS(operating system)에서 사용하는 데이터베이스 엔진은 SQLite일 수 있고, 데이터베이스의 특성 상 헤더 혹은 스키마가 깨진 경우 중요 메타데이터에 접근하지 못하여 데이터베이스에 접근 자체가 불가능해지고, 데이터베이스의 일부 데이터가 손상된 경우에도 다른 데이터에 접근하지 못하며, 데이터베이스의 초기화가 일어날 수 있다. 데이터베이스 초기화가 발생하면 연락처, 메시지, 노트와 같은 중요 사용자 데이터 또한 전부 유실될 수 있다.
본 문서에 개시되는 다양한 실시예에 따르면, 데이터베이스 손상이 발생한 경우 안드로이드 디바이스 상에서 런타임에 해당 데이터베이스를 복구하는 기법을 제공할 수 있다. 런타임 데이터베이스 복구 기법을 통해, 사용자는 중요 데이터의 유실 없이 해당 어플리케이션 및/또는 데이터를 이용하는 것을 보장 받을 수 있다.
본 개시의 앙태는 적어도 상기에서 언급된 문제 및/또는 단점을 해결하고 적어도 아래에서 설명되는 이점을 제공하는 것이다. 따라서, 본 개시의 일 측면은 데이터베이스 복원을 위한 전자 장치 및 전자 장치의 동작 방법을 제공하는데 있다.
본 개시의 양태에 따르면, 전자 장치가 제공된다. 전자 장치는 데이터베이스를 저장하는 비휘발성의 제1 메모리, 휘발성의 제2 메모리 및 제1 메모리 및 제2 메모리와 작동적으로 연결된(operably connected to) 프로세서를 포함할 수 있다. 프로세서는 데이터베이스의 손상(corruption) 여부를 판단하고, 데이터베이스가 손상된 것으로 판단되면, 데이터베이스의 적어도 일부가 제2 메모리의 사용자 영역으로 로딩된 DB 캐시(database cache)를 초기화한 후 데이터베이스의 제1 무결성 확인(first integrity check)을 수행하고, 데이터베이스의 제1 무결성 확인이 실패하면, 데이터베이스의 적어도 일부가 제2 메모리의 커널 영역으로 로딩된 OS 캐시(operating system cache)를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행하고, 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면, 데이터베이스 파일에 대한 작업을 수행할 수 있다.
본 개시의 다른 양태에 따르면, 전자 장치의 동작 방법이 제공된다. 동작 방법은 전자 장치의 비휘발성의 제1 메모리에 저장된 데이터베이스의 손상 여부를 판단하는 동작, 데이터베이스가 손상된 것으로 판단되면, 데이터베이스의 적어도 일부가 제2 메모리의 사용자 영역으로 로딩된 DB 캐시를 초기화한 후 데이터베이스의 제1 무결성 확인을 수행하는 동작, 데이터베이스의 제1 무결성 확인이 실패하면, 데이터베이스의 적어도 일부가 제2 메모리의 커널 영역으로 로딩된 OS 캐시를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행하는 동작 및 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면, 데이터베이스 파일에 대한 작업을 수행하는 동작을 포함할 수 있다.
다양한 실시예에 따르면, 데이터베이스 손상이 발생할 시, 고도화된 무결성 검증 기반 복구 기법, 백업 메타데이터 복구 기법, 템플릿 복구 기법, 기타 복구 기법이 순차적으로 실행됨으로써, 유실된 데이터베이스를 정상적으로 복구하거나 유실된 데이터를 최소화할 수 있다.
또한, 다양한 실시예에 따르면, 데이터베이스 손상이 발생한 경우 안드로이드 디바이스 상에서 런타임에 해당 데이터베이스를 복구하는 기법을 제공함으로써, 사용자는 중요 데이터의 유실 없이 해당 어플리케이션 및/또는 데이터를 이용하는 것을 보장 받을 수 있다.
본 개시의 다른 측면, 이점 및 핵심적인 특징들(salient features)은 첨부 도면과 함께 본 개시의 다양한 실시예를 개시하는 다음의 상세한 설명으로부터 당업자에게 명백해질 것이다.
도 1 은 본 개시의 일 실시예에 따른 네트워크 환경 내의 전자 장치의 블록도를 나타낸다.
도 2는 본 개시의 일 실시예에 따른 프로그램을 예시하는 블록도이다.
도 3 은 본 개시의 일 실시예에 따른 전자 장치에 저장된 데이터베이스와 관련된 동작을 설명하기 위한 도면이다.
도 4는 본 개시의 일 실시예에 따른 데이터베이스의 손상을 복구하는 동작을 설명하기 위한 도면이다.
도 5 및 도 6은 본 개시의 다양한 실시예에 따른 고도화된 무결성 검증 기반 복구 동작을 설명하기 위한 도면이다.
도7 내지 도 10은 본 개시의 다양한 실시예에 따른 백업 메타데이터 복구 동작을 설명하기 위한 도면이다.
도 11 및 도 12는 본 개시의 다양한 실시예에 따른 템플릿 복구 동작을 설명하기 위한 도면이다.
도 13은 본 개시의 일 실시예에 따른 기타 복구 동작을 설명하기 위한 도면이다.
도 14는 본 개시의 일 실시예에 따른 전자 장치의 동작 방법을 나타낸 도면이다.
도 15는 본 개시의 일 실시예에 따른 전자 장치를 나타낸 도면이다.
도면들에 걸쳐, 유사한 참조 번호는 유사한 부품, 구성요소 및 구조를 지칭하는 것으로 이해될 것이다.
이하, 실시예들을 첨부된 도면들을 참조하여 상세하게 설명한다. 첨부 도면을 참조하여 설명함에 있어, 도면 부호에 관계없이 동일한 구성 요소는 동일한 참조 부호를 부여하고, 이에 대한 중복되는 설명은 생략하기로 한다.
첨부된 도면을 참조하여 다음의 설명은 특허청구범위 및 그 균등물에 의해 정의된 바와 같은 본 개시의 다양한 실시예의 포괄적인 이해를 돕기 위해 제공된다. 여기에는 이해를 돕기 위한 다양한 특정 세부사항들이 포함되어 있지만, 이는 단지 예시적인 것으로 간주되어야 한다. 따라서, 본 기술분야의 통상의 지식을 가진 자는 본 개시의 범위 및 사상을 벗어나지 않고 본 명세서에 기술된 다양한 실시예의 다양한 변경 및 수정이 이루어질 수 있음을 인식할 것이다. 또한, 명료함과 간결함을 위해 잘 알려진 기능 및 구성에 대한 설명은 생략될 수 있다.
다음의 설명 및 특허청구범위에서 사용된 용어 및 단어는 서지적 의미에 한정되지 않으며, 본 개시의 명확하고 일관된 이해를 가능하게 하기 ㅜ이해 발명자가 사용한 것에 불과하다. 따라서, 본 개시의 다양한 실시예에 대한 다음의 설명은 첨부된 특허청구범위 및 그 균등물에 의해 정의된 바와 같이 본 개시를 제한하기 위한 것이 아니라 단지 예시의 목적으로 제공된다는 것이 당업자에게 맹백해야 한다.
단수 형태는 문맥이 명백하게 달리 지시하지 않는 한 복수 지시대상을 포함하는 것으로 이해되어야 한다. 따라서, 예를 들어, "구성요소 표면"에 대한 언급은 그러한 표면들 중 하나 이상에 대한 언급을 포함한다.
도 1은 본 개시의 일 실시예들에 따른 네트워크 환경 내의 전자 장치의 블록도를 나타낸다.
도 1은, 다양한 실시예들에 따른, 네트워크 환경(100) 내의 전자 장치(101)의 블록도이다. 도 1을 참조하면, 네트워크 환경(100)에서 전자 장치(101)는 제1 네트워크(198)(예: 근거리 무선 통신 네트워크)를 통하여 전자 장치(102)와 통신하거나, 또는 제2 네트워크(199)(예: 원거리 무선 통신 네트워크)를 통하여 전자 장치(104) 또는 서버(108) 중 적어도 하나와 통신할 수 있다. 일실시예에 따르면, 전자 장치(101)는 서버(108)를 통하여 전자 장치(104)와 통신할 수 있다. 일실시예에 따르면, 전자 장치(101)는 프로세서(120), 메모리(130), 입력 모듈(150), 음향 출력 모듈(155), 디스플레이 모듈(160), 오디오 모듈(170), 센서 모듈(176), 인터페이스(177), 연결 단자(178), 햅틱 모듈(179), 카메라 모듈(180), 전력 관리 모듈(188), 배터리(189), 통신 모듈(190), 가입자 식별 모듈(196), 또는 안테나 모듈(197)을 포함할 수 있다. 어떤 실시예에서는, 전자 장치(101)에는, 이 구성요소들 중 적어도 하나(예: 연결 단자(178))가 생략되거나, 하나 이상의 다른 구성요소가 추가될 수 있다. 어떤 실시예에서는, 이 구성요소들 중 일부들(예: 센서 모듈(176), 카메라 모듈(180), 또는 안테나 모듈(197))은 하나의 구성요소(예: 디스플레이 모듈(160))로 통합될 수 있다.
프로세서(120)는, 예를 들면, 소프트웨어(예: 프로그램(140))를 실행하여 프로세서(120)에 연결된 전자 장치(101)의 적어도 하나의 다른 구성요소(예: 하드웨어 또는 소프트웨어 구성요소)를 제어할 수 있고, 다양한 데이터 처리 또는 연산을 수행할 수 있다. 일실시예에 따르면, 데이터 처리 또는 연산의 적어도 일부로서, 프로세서(120)는 다른 구성요소(예: 센서 모듈(176) 또는 통신 모듈(190))로부터 수신된 명령 또는 데이터를 휘발성 메모리(132)에 저장하고, 휘발성 메모리(132)에 저장된 명령 또는 데이터를 처리하고, 결과 데이터를 비휘발성 메모리(134)에 저장할 수 있다. 일실시예에 따르면, 프로세서(120)는 메인 프로세서(121)(예: 중앙 처리 장치 또는 어플리케이션 프로세서) 또는 이와는 독립적으로 또는 함께 운영 가능한 보조 프로세서(123)(예: 그래픽 처리 장치(GPU; graphics processing unit), 신경망 처리 장치(NPU: neural processing unit), 이미지 시그널 프로세서, 센서 허브 프로세서, 또는 커뮤니케이션 프로세서)를 포함할 수 있다. 예를 들어, 전자 장치(101)가 메인 프로세서(121) 및 보조 프로세서(123)를 포함하는 경우, 보조 프로세서(123)는 메인 프로세서(121)보다 저전력을 사용하거나, 지정된 기능에 특화되도록 설정될 수 있다. 보조 프로세서(123)는 메인 프로세서(121)와 별개로, 또는 그 일부로서 구현될 수 있다.
보조 프로세서(123)는, 예를 들면, 메인 프로세서(121)가 인액티브(예: 슬립) 상태에 있는 동안 메인 프로세서(121)를 대신하여, 또는 메인 프로세서(121)가 액티브(예: 어플리케이션 실행) 상태에 있는 동안 메인 프로세서(121)와 함께, 전자 장치(101)의 구성요소들 중 적어도 하나의 구성요소(예: 디스플레이 모듈(160), 센서 모듈(176), 또는 통신 모듈(190))와 관련된 기능 또는 상태들의 적어도 일부를 제어할 수 있다. 일실시예에 따르면, 보조 프로세서(123)(예: 이미지 시그널 프로세서 또는 커뮤니케이션 프로세서)는 기능적으로 관련 있는 다른 구성요소(예: 카메라 모듈(180) 또는 통신 모듈(190))의 일부로서 구현될 수 있다. 일실시예에 따르면, 보조 프로세서(123)(예: 신경망 처리 장치)는 인공지능 모델의 처리에 특화된 하드웨어 구조를 포함할 수 있다. 인공지능 모델은 기계 학습을 통해 생성될 수 있다. 이러한 학습은, 예를 들어, 인공지능 모델이 수행되는 전자 장치(101) 자체에서 수행될 수 있고, 별도의 서버(예: 서버(108))를 통해 수행될 수도 있다. 학습 알고리즘은, 예를 들어, 지도형 학습(supervised learning), 비지도형 학습(unsupervised learning), 준지도형 학습(semi-supervised learning) 또는 강화 학습(reinforcement learning)을 포함할 수 있으나, 전술한 예에 한정되지 않는다. 인공지능 모델은, 복수의 인공 신경망 레이어들을 포함할 수 있다. 인공 신경망은 심층 신경망(DNN: deep neural network), CNN(convolutional neural network), RNN(recurrent neural network), RBM(restricted boltzmann machine), DBN(deep belief network), BRDNN(bidirectional recurrent deep neural network), 심층 Q-네트워크(deep Q-networks) 또는 상기 중 둘 이상의 조합 중 하나일 수 있으나, 전술한 예에 한정되지 않는다. 인공지능 모델은 하드웨어 구조 이외에, 추가적으로 또는 대체적으로, 소프트웨어 구조를 포함할 수 있다.
메모리(130)는, 전자 장치(101)의 적어도 하나의 구성요소(예: 프로세서(120) 또는 센서 모듈(176))에 의해 사용되는 다양한 데이터를 저장할 수 있다. 데이터는, 예를 들어, 소프트웨어(예: 프로그램(140)) 및, 이와 관련된 명령에 대한 입력 데이터 또는 출력 데이터를 포함할 수 있다. 메모리(130)는, 휘발성 메모리(132) 또는 비휘발성 메모리(134)를 포함할 수 있다.
프로그램(140)은 메모리(130)에 소프트웨어로서 저장될 수 있으며, 예를 들면, 운영 체제(142), 미들 웨어(144) 또는 어플리케이션(146)을 포함할 수 있다.
입력 모듈(150)은, 전자 장치(101)의 구성요소(예: 프로세서(120))에 사용될 명령 또는 데이터를 전자 장치(101)의 외부(예: 사용자)로부터 수신할 수 있다. 입력 모듈(150)은, 예를 들면, 마이크, 마우스, 키보드, 키(예: 버튼), 또는 디지털 펜(예: 스타일러스 펜)을 포함할 수 있다.
음향 출력 모듈(155)은 음향 신호를 전자 장치(101)의 외부로 출력할 수 있다. 음향 출력 모듈(155)은, 예를 들면, 스피커 또는 리시버를 포함할 수 있다. 스피커는 멀티미디어 재생 또는 녹음 재생과 같이 일반적인 용도로 사용될 수 있다. 리시버는 착신 전화를 수신하기 위해 사용될 수 있다. 일실시예에 따르면, 리시버는 스피커와 별개로, 또는 그 일부로서 구현될 수 있다.
디스플레이 모듈(160)은 전자 장치(101)의 외부(예: 사용자)로 정보를 시각적으로 제공할 수 있다. 디스플레이 모듈(160)은, 예를 들면, 디스플레이, 홀로그램 장치, 또는 프로젝터 및 해당 장치를 제어하기 위한 제어 회로를 포함할 수 있다. 일실시예에 따르면, 디스플레이 모듈(160)은 터치를 감지하도록 설정된 터치 센서, 또는 상기 터치에 의해 발생되는 힘의 세기를 측정하도록 설정된 압력 센서를 포함할 수 있다.
오디오 모듈(170)은 소리를 전기 신호로 변환시키거나, 반대로 전기 신호를 소리로 변환시킬 수 있다. 일실시예에 따르면, 오디오 모듈(170)은, 입력 모듈(150)을 통해 소리를 획득하거나, 음향 출력 모듈(155), 또는 전자 장치(101)와 직접 또는 무선으로 연결된 외부 전자 장치(예: 전자 장치(102))(예: 스피커 또는 헤드폰)를 통해 소리를 출력할 수 있다.
센서 모듈(176)은 전자 장치(101)의 작동 상태(예: 전력 또는 온도), 또는 외부의 환경 상태(예: 사용자 상태)를 감지하고, 감지된 상태에 대응하는 전기 신호 또는 데이터 값을 생성할 수 있다. 일실시예에 따르면, 센서 모듈(176)은, 예를 들면, 제스처 센서, 자이로 센서, 기압 센서, 마그네틱 센서, 가속도 센서, 그립 센서, 근접 센서, 컬러 센서, IR(infrared) 센서, 생체 센서, 온도 센서, 습도 센서, 또는 조도 센서를 포함할 수 있다.
인터페이스(177)는 전자 장치(101)가 외부 전자 장치(예: 전자 장치(102))와 직접 또는 무선으로 연결되기 위해 사용될 수 있는 하나 이상의 지정된 프로토콜들을 지원할 수 있다. 일실시예에 따르면, 인터페이스(177)는, 예를 들면, HDMI(high definition multimedia interface), USB(universal serial bus) 인터페이스, SD카드 인터페이스, 또는 오디오 인터페이스를 포함할 수 있다.
연결 단자(178)는, 그를 통해서 전자 장치(101)가 외부 전자 장치(예: 전자 장치(102))와 물리적으로 연결될 수 있는 커넥터를 포함할 수 있다. 일실시예에 따르면, 연결 단자(178)는, 예를 들면, HDMI 커넥터, USB 커넥터, SD 카드 커넥터, 또는 오디오 커넥터(예: 헤드폰 커넥터)를 포함할 수 있다.
햅틱 모듈(179)은 전기적 신호를 사용자가 촉각 또는 운동 감각을 통해서 인지할 수 있는 기계적인 자극(예: 진동 또는 움직임) 또는 전기적인 자극으로 변환할 수 있다. 일실시예에 따르면, 햅틱 모듈(179)은, 예를 들면, 모터, 압전 소자, 또는 전기 자극 장치를 포함할 수 있다.
카메라 모듈(180)은 정지 영상 및 동영상을 촬영할 수 있다. 일실시예에 따르면, 카메라 모듈(180)은 하나 이상의 렌즈들, 이미지 센서들, 이미지 시그널 프로세서들, 또는 플래쉬들을 포함할 수 있다.
전력 관리 모듈(188)은 전자 장치(101)에 공급되는 전력을 관리할 수 있다. 일실시예에 따르면, 전력 관리 모듈(188)은, 예를 들면, PMIC(power management integrated circuit)의 적어도 일부로서 구현될 수 있다.
배터리(189)는 전자 장치(101)의 적어도 하나의 구성요소에 전력을 공급할 수 있다. 일실시예에 따르면, 배터리(189)는, 예를 들면, 재충전 불가능한 1차 전지, 재충전 가능한 2차 전지 또는 연료 전지를 포함할 수 있다.
통신 모듈(190)은 전자 장치(101)와 외부 전자 장치(예: 전자 장치(102), 전자 장치(104), 또는 서버(108)) 간의 직접(예: 유선) 통신 채널 또는 무선 통신 채널의 수립, 및 수립된 통신 채널을 통한 통신 수행을 지원할 수 있다. 통신 모듈(190)은 프로세서(120)(예: 어플리케이션 프로세서(application processor(AP)))와 독립적으로 운영되고, 직접(예: 유선) 통신 또는 무선 통신을 지원하는 하나 이상의 커뮤니케이션 프로세서를 포함할 수 있다. 일실시예에 따르면, 통신 모듈(190)은 무선 통신 모듈(192)(예: 셀룰러 통신 모듈, 근거리 무선 통신 모듈, 또는 GNSS(global navigation satellite system) 통신 모듈) 또는 유선 통신 모듈(194)(예: LAN(local area network) 통신 모듈, 또는 전력선 통신 모듈)을 포함할 수 있다. 이들 통신 모듈 중 해당하는 통신 모듈은 제1 네트워크(198)(예: 블루투스, WiFi(wireless fidelity) direct 또는 IrDA(infrared data association)와 같은 근거리 통신 네트워크) 또는 제2 네트워크(199)(예: 레거시 셀룰러 네트워크, 5세대 (5G) 네트워크, 차세대 통신 네트워크, 인터넷, 또는 컴퓨터 네트워크(예: LAN 또는 WAN)와 같은 원거리 통신 네트워크)를 통하여 외부의 전자 장치(104)와 통신할 수 있다. 이런 여러 종류의 통신 모듈들은 하나의 구성요소(예: 단일 칩)로 통합되거나, 또는 서로 별도의 복수의 구성요소들(예: 복수 칩들)로 구현될 수 있다. 무선 통신 모듈(192)은 가입자 식별 모듈(196)에 저장된 가입자 정보(예: 국제 모바일 가입자 식별자(IMSI))를 이용하여 제1 네트워크(198) 또는 제2 네트워크(199)와 같은 통신 네트워크 내에서 전자 장치(101)를 확인 또는 인증할 수 있다.
무선 통신 모듈(192)은 4G 네트워크 이후의 5G 네트워크 및 차세대 통신 기술, 예를 들어, NR 접속 기술(new radio access technology)을 지원할 수 있다. NR 접속 기술은 고용량 데이터의 고속 전송(eMBB(enhanced mobile broadband)), 단말 전력 최소화와 다수 단말의 접속(mMTC(massive machine type communications)), 또는 고신뢰도와 저지연(URLLC(ultra-reliable and low-latency communications))을 지원할 수 있다. 무선 통신 모듈(192)은, 예를 들어, 높은 데이터 전송률 달성을 위해, 고주파 대역(예: 밀리미터(mm) Wave 대역)을 지원할 수 있다. 무선 통신 모듈(192)은 고주파 대역에서의 성능 확보를 위한 다양한 기술들, 예를 들어, 빔포밍(beamforming), 거대 배열 다중 입출력(massive MIMO(multiple-input and multiple-output)), 전차원 다중입출력(FD-MIMO: full dimensional MIMO), 어레이 안테나(array antenna), 아날로그 빔형성(analog beam-forming), 또는 대규모 안테나(large-scale antenna)와 같은 기술들을 지원할 수 있다. 무선 통신 모듈(192)은 전자 장치(101), 외부 전자 장치(예: 전자 장치(104)) 또는 네트워크 시스템(예: 제2 네트워크(199))에 규정되는 다양한 요구사항을 지원할 수 있다. 일실시예에 따르면, 무선 통신 모듈(192)은 eMBB 실현을 위한 Peak data rate(예: 20Gbps 이상), mMTC 실현을 위한 손실 Coverage(예: 164dB 이하), 또는 URLLC 실현을 위한 U-plane latency(예: 다운링크(DL) 및 업링크(UL) 각각 0.5ms 이하, 또는 라운드 트립 1ms 이하)를 지원할 수 있다.
안테나 모듈(197)은 신호 또는 전력을 외부(예: 외부의 전자 장치)로 송신하거나 외부로부터 수신할 수 있다. 일실시예에 따르면, 안테나 모듈(197)은 서브스트레이트(예: PCB) 위에 형성된 도전체 또는 도전성 패턴으로 이루어진 방사체를 포함하는 안테나를 포함할 수 있다. 일실시예에 따르면, 안테나 모듈(197)은 복수의 안테나들(예: 어레이 안테나)을 포함할 수 있다. 이런 경우, 제1 네트워크(198) 또는 제2 네트워크(199)와 같은 통신 네트워크에서 사용되는 통신 방식에 적합한 적어도 하나의 안테나가, 예를 들면, 통신 모듈(190)에 의하여 상기 복수의 안테나들로부터 선택될 수 있다. 신호 또는 전력은 상기 선택된 적어도 하나의 안테나를 통하여 통신 모듈(190)과 외부의 전자 장치 간에 송신되거나 수신될 수 있다. 어떤 실시예에 따르면, 방사체 이외에 다른 부품(예: RFIC(radio frequency integrated circuit))이 추가로 안테나 모듈(197)의 일부로 형성될 수 있다.
다양한 실시예에 따르면, 안테나 모듈(197)은 mmWave 안테나 모듈을 형성할 수 있다. 일실시예에 따르면, mmWave 안테나 모듈은 인쇄 회로 기판, 상기 인쇄 회로 기판의 제1 면(예: 아래 면)에 또는 그에 인접하여 배치되고 지정된 고주파 대역(예: mmWave 대역)을 지원할 수 있는 RFIC, 및 상기 인쇄 회로 기판의 제2 면(예: 윗 면 또는 측 면)에 또는 그에 인접하여 배치되고 상기 지정된 고주파 대역의 신호를 송신 또는 수신할 수 있는 복수의 안테나들(예: 어레이 안테나)을 포함할 수 있다.
상기 구성요소들 중 적어도 일부는 주변 기기들간 통신 방식(예: 버스, GPIO(general purpose input and output), SPI(serial peripheral interface), 또는 MIPI(mobile industry processor interface))을 통해 서로 연결되고 신호(예: 명령 또는 데이터)를 상호간에 교환할 수 있다.
일실시예에 따르면, 명령 또는 데이터는 제2 네트워크(199)에 연결된 서버(108)를 통해서 전자 장치(101)와 외부의 전자 장치(104)간에 송신 또는 수신될 수 있다. 외부의 전자 장치(102, 또는 104) 각각은 전자 장치(101)와 동일한 또는 다른 종류의 장치일 수 있다. 일실시예에 따르면, 전자 장치(101)에서 실행되는 동작들의 전부 또는 일부는 외부의 전자 장치들(102, 104, 또는 108) 중 하나 이상의 외부의 전자 장치들에서 실행될 수 있다. 예를 들면, 전자 장치(101)가 어떤 기능이나 서비스를 자동으로, 또는 사용자 또는 다른 장치로부터의 요청에 반응하여 수행해야 할 경우에, 전자 장치(101)는 기능 또는 서비스를 자체적으로 실행시키는 대신에 또는 추가적으로, 하나 이상의 외부의 전자 장치들에게 그 기능 또는 그 서비스의 적어도 일부를 수행하라고 요청할 수 있다. 상기 요청을 수신한 하나 이상의 외부의 전자 장치들은 요청된 기능 또는 서비스의 적어도 일부, 또는 상기 요청과 관련된 추가 기능 또는 서비스를 실행하고, 그 실행의 결과를 전자 장치(101)로 전달할 수 있다. 전자 장치(101)는 상기 결과를, 그대로 또는 추가적으로 처리하여, 상기 요청에 대한 응답의 적어도 일부로서 제공할 수 있다. 이를 위하여, 예를 들면, 클라우드 컴퓨팅, 분산 컴퓨팅, 모바일 에지 컴퓨팅(MEC: mobile edge computing), 또는 클라이언트-서버 컴퓨팅 기술이 이용될 수 있다. 전자 장치(101)는, 예를 들어, 분산 컴퓨팅 또는 모바일 에지 컴퓨팅을 이용하여 초저지연 서비스를 제공할 수 있다. 다른 실시예에 있어서, 외부의 전자 장치(104)는 IoT(internet of things) 기기를 포함할 수 있다. 서버(108)는 기계 학습 및/또는 신경망을 이용한 지능형 서버일 수 있다. 일실시예에 따르면, 외부의 전자 장치(104) 또는 서버(108)는 제2 네트워크(199) 내에 포함될 수 있다. 전자 장치(101)는 5G 통신 기술 및 IoT 관련 기술을 기반으로 지능형 서비스(예: 스마트 홈, 스마트 시티, 스마트 카, 또는 헬스 케어)에 적용될 수 있다.
도 2는 본 개시의 일 실시예에 따른 프로그램을 예시하는 블록도이다.
도 2를 참조하면, 일 실시예에 따른 프로그램(140)을 예시하는 블록도(200)이다. 일실시예에 따르면, 프로그램(140)은 전자 장치(101)의 하나 이상의 리소스들을 제어하기 위한 운영 체제(142), 미들웨어(144), 또는 상기 운영 체제(142)에서 실행 가능한 어플리케이션(146)을 포함할 수 있다. 운영 체제(142)는, 예를 들면, AndroidTM, iOSTM, WindowsTM, SymbianTM, TizenTM, 또는 BadaTM를 포함할 수 있다. 프로그램(140) 중 적어도 일부 프로그램은, 예를 들면, 제조 시에 전자 장치(101)에 프리로드되거나, 또는 사용자에 의해 사용 시 외부 전자 장치(예: 전자 장치(102 또는 104), 또는 서버(108))로부터 다운로드되거나 갱신 될 수 있다.
운영 체제(142)는 전자 장치(101)의 하나 이상의 시스템 리소스들(예: 프로세스, 메모리, 또는 전원)의 관리(예: 할당 또는 회수)를 제어할 수 있다. 운영 체제(142)는, 추가적으로 또는 대체적으로, 전자 장치(101)의 다른 하드웨어 디바이스, 예를 들면, 입력 모듈(150), 음향 출력 모듈(155), 디스플레이 모듈(160), 오디오 모듈(170), 센서 모듈(176), 인터페이스(177), 햅틱 모듈(179), 카메라 모듈(180), 전력 관리 모듈(188), 배터리(189), 통신 모듈(190), 가입자 식별 모듈(196), 또는 안테나 모듈(197)을 구동하기 위한 하나 이상의 드라이버 프로그램들을 포함할 수 있다.
미들웨어(144)는 전자 장치(101)의 하나 이상의 리소스들로부터 제공되는 기능 또는 정보가 어플리케이션(146)에 의해 사용될 수 있도록 다양한 기능들을 어플리케이션(146)으로 제공할 수 있다. 미들웨어(144)는, 예를 들면, 어플리케이션 매니저(201), 윈도우 매니저(203), 멀티미디어 매니저(205), 리소스 매니저(207), 파워 매니저(209), 데이터베이스 매니저(211), 패키지 매니저(213), 커넥티비티 매니저(215), 노티피케이션 매니저(217), 로케이션 매니저(219), 그래픽 매니저(221), 시큐리티 매니저(223), 통화 매니저(225), 또는 음성 인식 매니저(227)를 포함할 수 있다.
어플리케이션 매니저(201)는, 예를 들면, 어플리케이션(146)의 생명 주기를 관리할 수 있다. 윈도우 매니저(203)는, 예를 들면, 화면에서 사용되는 하나 이상의 GUI 자원들을 관리할 수 있다. 멀티미디어 매니저(205)는, 예를 들면, 미디어 파일들의 재생에 필요한 하나 이상의 포맷들을 파악하고, 그 중 선택된 해당하는 포맷에 맞는 코덱을 이용하여 상기 미디어 파일들 중 해당하는 미디어 파일의 인코딩 또는 디코딩을 수행할 수 있다. 리소스 매니저(207)는, 예를 들면, 어플리케이션(146)의 소스 코드 또는 메모리(130)의 메모리의 공간을 관리할 수 있다. 파워 매니저(209)는, 예를 들면, 배터리(189)의 용량, 온도 또는 전원을 관리하고, 이 중 해당 정보를 이용하여 전자 장치(101)의 동작에 필요한 관련 정보를 결정 또는 제공할 수 있다. 일실시예에 따르면, 파워 매니저(209)는 전자 장치(101)의 바이오스(BIOS: basic input/output system)(미도시)와 연동할 수 있다.
데이터베이스 매니저(211)는, 예를 들면, 어플리케이션(146)에 의해 사용될 데이터베이스를 생성, 검색, 또는 변경할 수 있다. 패키지 매니저(213)는, 예를 들면, 패키지 파일의 형태로 배포되는 어플리케이션의 설치 또는 갱신을 관리할 수 있다. 커넥티비티 매니저(215)는, 예를 들면, 전자 장치(101)와 외부 전자 장치 간의 무선 연결 또는 직접 연결을 관리할 수 있다. 노티피케이션 매니저(217)는, 예를 들면, 지정된 이벤트(예: 착신 통화, 메시지, 또는 알람)의 발생을 사용자에게 알리기 위한 기능을 제공할 수 있다. 로케이션 매니저(219)는, 예를 들면, 전자 장치(101)의 위치 정보를 관리할 수 있다. 그래픽 매니저(221)는, 예를 들면, 사용자에게 제공될 하나 이상의 그래픽 효과들 또는 이와 관련된 사용자 인터페이스를 관리할 수 있다.
시큐리티 매니저(223)는, 예를 들면, 시스템 보안 또는 사용자 인증을 제공할 수 있다. 통화(telephony) 매니저(225)는, 예를 들면, 전자 장치(101)에 의해 제공되는 음성 통화 기능 또는 영상 통화 기능을 관리할 수 있다. 음성 인식 매니저(227)는, 예를 들면, 사용자의 음성 데이터를 서버(108)로 전송하고, 그 음성 데이터에 적어도 일부 기반하여 전자 장치(101)에서 수행될 기능에 대응하는 명령어(command), 또는 그 음성 데이터에 적어도 일부 기반하여 변환된 문자 데이터를 서버(108)로부터 수신할 수 있다. 일 실시예에 따르면, 미들웨어(244)는 동적으로 기존의 구성요소를 일부 삭제하거나 새로운 구성요소들을 추가할 수 있다. 일 실시예에 따르면, 미들웨어(144)의 적어도 일부는 운영 체제(142)의 일부로 포함되거나, 또는 운영 체제(142)와는 다른 별도의 소프트웨어로 구현될 수 있다.
어플리케이션(146)은, 예를 들면, 홈(251), 다이얼러(253), SMS/MMS(255), IM(instant message)(257), 브라우저(259), 카메라(261), 알람(263), 컨택트(265), 음성 인식(267), 이메일(269), 달력(271), 미디어 플레이어(273), 앨범(275), 와치(277), 헬스(279)(예: 운동량 또는 혈당과 같은 생체 정보를 측정), 또는 환경 정보(281)(예: 기압, 습도, 또는 온도 정보 측정) 어플리케이션을 포함할 수 있다. 일실시예에 따르면, 어플리케이션(146)은 전자 장치(101)와 외부 전자 장치 사이의 정보 교환을 지원할 수 있는 정보 교환 어플리케이션(미도시)을 더 포함할 수 있다. 정보 교환 어플리케이션은, 예를 들면, 외부 전자 장치로 지정된 정보 (예: 통화, 메시지, 또는 알람)를 전달하도록 설정된 노티피케이션 릴레이 어플리케이션, 또는 외부 전자 장치를 관리하도록 설정된 장치 관리 어플리케이션을 포함할 수 있다. 노티피케이션 릴레이 어플리케이션은, 예를 들면, 전자 장치(101)의 다른 어플리케이션(예: 이메일 어플리케이션(269))에서 발생된 지정된 이벤트(예: 메일 수신)에 대응하는 알림 정보를 외부 전자 장치로 전달할 수 있다. 추가적으로 또는 대체적으로, 노티피케이션 릴레이 어플리케이션은 외부 전자 장치로부터 알림 정보를 수신하여 전자 장치(101)의 사용자에게 제공할 수 있다.
장치 관리 어플리케이션은, 예를 들면, 전자 장치(101)와 통신하는 외부 전자 장치 또는 그 일부 구성 요소(예: 외부 전자장치의 디스플레이 모듈 또는 카메라 모듈)의 전원(예: 턴-온 또는 턴-오프) 또는 기능(예: 밝기, 해상도, 또는 포커스)을 제어할 수 있다. 장치 관리 어플리케이션은, 추가적으로 또는 대체적으로, 외부 전자 장치에서 동작하는 어플리케이션의 설치, 삭제, 또는 갱신을 지원할 수 있다.
본 문서에 개시된 다양한 실시예들에 따른 전자 장치는 다양한 형태의 장치가 될 수 있다. 전자 장치는, 예를 들면, 휴대용 통신 장치(예: 스마트폰), 컴퓨터 장치, 휴대용 멀티미디어 장치, 휴대용 의료 기기, 카메라, 웨어러블 장치, 또는 가전 장치를 포함할 수 있다. 본 문서의 실시예에 따른 전자 장치는 전술한 기기들에 한정되지 않는다.
본 문서의 다양한 실시예들 및 이에 사용된 용어들은 본 문서에 기재된 기술적 특징들을 특정한 실시예들로 한정하려는 것이 아니며, 해당 실시예의 다양한 변경, 균등물, 또는 대체물을 포함하는 것으로 이해되어야 한다. 도면의 설명과 관련하여, 유사한 또는 관련된 구성요소에 대해서는 유사한 참조 부호가 사용될 수 있다. 아이템에 대응하는 명사의 단수 형은 관련된 문맥상 명백하게 다르게 지시하지 않는 한, 상기 아이템 한 개 또는 복수 개를 포함할 수 있다. 본 문서에서, "A 또는 B", "A 및 B 중 적어도 하나", "A 또는 B 중 적어도 하나", "A, B 또는 C", "A, B 및 C 중 적어도 하나", 및 "A, B, 또는 C 중 적어도 하나"와 같은 문구들 각각은 그 문구들 중 해당하는 문구에 함께 나열된 항목들 중 어느 하나, 또는 그들의 모든 가능한 조합을 포함할 수 있다. "제1", "제2", 또는 "첫째" 또는 "둘째"와 같은 용어들은 단순히 해당 구성요소를 다른 해당 구성요소와 구분하기 위해 사용될 수 있으며, 해당 구성요소들을 다른 측면(예: 중요성 또는 순서)에서 한정하지 않는다. 어떤(예: 제1) 구성요소가 다른(예: 제2) 구성요소에, "기능적으로" 또는 "통신적으로"라는 용어와 함께 또는 이런 용어 없이, "커플드" 또는 "커넥티드"라고 언급된 경우, 그것은 상기 어떤 구성요소가 상기 다른 구성요소에 직접적으로(예: 유선으로), 무선으로, 또는 제3 구성요소를 통하여 연결될 수 있다는 것을 의미한다.
본 문서의 다양한 실시예들에서 사용된 용어 "모듈"은 하드웨어, 소프트웨어 또는 펌웨어로 구현된 유닛을 포함할 수 있으며, 예를 들면, 로직, 논리 블록, 부품, 또는 회로와 같은 용어와 상호 호환적으로 사용될 수 있다. 모듈은, 일체로 구성된 부품 또는 하나 또는 그 이상의 기능을 수행하는, 상기 부품의 최소 단위 또는 그 일부가 될 수 있다. 예를 들면, 일실시예에 따르면, 모듈은 ASIC(application-specific integrated circuit)의 형태로 구현될 수 있다.
본 문서의 다양한 실시예들은 기기(machine)(예: 전자 장치(101)) 의해 읽을 수 있는 저장 매체(storage medium)(예: 내장 메모리(136) 또는 외장 메모리(138))에 저장된 하나 이상의 명령어들을 포함하는 소프트웨어(예: 프로그램(140))로서 구현될 수 있다. 예를 들면, 기기(예: 전자 장치(101))의 프로세서(예: 프로세서(120))는, 저장 매체로부터 저장된 하나 이상의 명령어들 중 적어도 하나의 명령을 호출하고, 그것을 실행할 수 있다. 이것은 기기가 상기 호출된 적어도 하나의 명령어에 따라 적어도 하나의 기능을 수행하도록 운영되는 것을 가능하게 한다. 상기 하나 이상의 명령어들은 컴파일러에 의해 생성된 코드 또는 인터프리터에 의해 실행될 수 있는 코드를 포함할 수 있다. 기기로 읽을 수 있는 저장 매체는, 비일시적(non-transitory) 저장 매체의 형태로 제공될 수 있다. 여기서, ‘비일시적’은 저장 매체가 실재(tangible)하는 장치이고, 신호(signal)(예: 전자기파)를 포함하지 않는다는 것을 의미할 뿐이며, 이 용어는 데이터가 저장 매체에 반영구적으로 저장되는 경우와 임시적으로 저장되는 경우를 구분하지 않는다.
일실시예에 따르면, 본 문서에 개시된 다양한 실시예들에 따른 방법은 컴퓨터 프로그램 제품(computer program product)에 포함되어 제공될 수 있다. 컴퓨터 프로그램 제품은 상품으로서 판매자 및 구매자 간에 거래될 수 있다. 컴퓨터 프로그램 제품은 기기로 읽을 수 있는 저장 매체(예: compact disc read only memory(CD-ROM))의 형태로 배포되거나, 또는 어플리케이션 스토어(예: 플레이 스토어TM)를 통해 또는 두 개의 사용자 장치들(예: 스마트 폰들) 간에 직접, 온라인으로 배포(예: 다운로드 또는 업로드)될 수 있다. 온라인 배포의 경우에, 컴퓨터 프로그램 제품의 적어도 일부는 제조사의 서버, 어플리케이션 스토어의 서버, 또는 중계 서버의 메모리와 같은 기기로 읽을 수 있는 저장 매체에 적어도 일시 저장되거나, 임시적으로 생성될 수 있다.
다양한 실시예들에 따르면, 상기 기술한 구성요소들의 각각의 구성요소(예: 모듈 또는 프로그램)는 단수 또는 복수의 개체를 포함할 수 있으며, 복수의 개체 중 일부는 다른 구성요소에 분리 배치될 수도 있다. 다양한 실시예들에 따르면, 전술한 해당 구성요소들 중 하나 이상의 구성요소들 또는 동작들이 생략되거나, 또는 하나 이상의 다른 구성요소들 또는 동작들이 추가될 수 있다. 대체적으로 또는 추가적으로, 복수의 구성요소들(예: 모듈 또는 프로그램)은 하나의 구성요소로 통합될 수 있다. 이런 경우, 통합된 구성요소는 상기 복수의 구성요소들 각각의 구성요소의 하나 이상의 기능들을 상기 통합 이전에 상기 복수의 구성요소들 중 해당 구성요소에 의해 수행되는 것과 동일 또는 유사하게 수행할 수 있다. 다양한 실시예들에 따르면, 모듈, 프로그램 또는 다른 구성요소에 의해 수행되는 동작들은 순차적으로, 병렬적으로, 반복적으로, 또는 휴리스틱하게 실행되거나, 상기 동작들 중 하나 이상이 다른 순서로 실행되거나, 생략되거나, 또는 하나 이상의 다른 동작들이 추가될 수 있다.
도 3은 본 개시의 일 실시예에 따른 전자 장치에 저장된 데이터베이스와 관련된 동작을 설명하기 위한 도면이다.
도 3을 참조하면, 전자 장치(101)는 스마트폰, 스마트패드, 태블릿 PC, PDA(Personal Digital Assistance), 랩톱 PC 또는 데스크톱 PC 중 적어도 하나에 대응할 수 있다. 전자 장치(101)는 액세서리형(예: 시계, 반지, 팔찌, 발찌, 목걸이, 안경, 콘택트 렌즈, 또는 머리 착용형 장치(head-mounted-device(HMD)), 직물 또는 의류 일체형(예: 전자 의복), 신체 부착형(예: 스킨 패드(skin pad) 또는 문신), 또는 생체 이식형(예: implantable circuit) 중 적어도 하나를 포함하는 웨어러블 장치(wearable device)에 대응할 수 있다. 전자 장치(101)는 냉장고, TV(television), 청소기, 에어컨(air-conditioner), 세탁기 및 조명 장치와 같은 가전 제품일 수 있다. 전자 장치(101)는 프로세서(120), 메모리(130) 및 디스플레이 모듈(160)를 포함할 수 있다. 전자 장치(101)는 도 1에 도시된 전자 장치(101)과 적어도 일부가 동일할 수 있다.
다양한 실시예들에 따르면, 프로세서(120)는 메모리(130)내에 저장된 하나 이상의 인스트럭션을 실행할 수 있다. 프로세서(120)는 데이터를 처리하기 위한 회로, 예를 들어, IC(Integrated Circuit), ALU(Arithmetic Logic Unit), FPGA(Field Programmable Gate Array) 및 LSI(Large-Scale Integration) 중 적어도 하나를 포함할 수 있다. 메모리(130)는 전자 장치(101)와 관련된 데이터를 저장할 수 있다. 메모리(130)는 SRAM(Static Random Access Memory) 또는 DRAM(Dynamic RAM) 등을 포함하는 RAM(Random Access Memory)과 같은 휘발성 메모리(132)를 포함하거나, ROM(Read Only Memory), MRAM(Magnetoresistive RAM), STT-MRAM(Spin-Transfer Torque MRAM), PRAM(Phase-change RAM), RRAM(Resistive RAM), FeRAM(Ferroelectric RAM) 뿐만 아니라 플래시 메모리, eMMC(Embedded Multi Media Card), SSD(Solid State Drive) 등과 같은 비휘발성 메모리(134)를 포함할 수 있다. 비휘발성 메모리(134)는 전자 장치(101) 내에 포함되는 내장 메모리(136)의 형태 및/또는 전자 장치(101)에 탈착 가능한(detachable to) 외장 메모리(138)의 형태를 가질 수 있다.
다양한 실시예들에 따르면, 메모리(130)는 어플리케이션(146)과 관련된 인스트럭션 및 운영 체제(예: 도 1의 운영 체제(142))와 관련된 인스트럭션을 저장할 수 있다. 운영 체제는 프로세서(120)에 의해 실행되는 시스템 소프트웨어일 수 있다. 프로세서(120)는 운영 체제를 실행함으로써, 전자 장치(101)에 포함된 하드웨어 컴포넌트들(예: 도 1의 메모리(130) 내지 도 1의 안테나 모듈(197))을 관리할 수 있다. 운영 체제는 시스템 소프트웨어를 제외한 나머지 소프트웨어인 어플리케이션(146)으로 API(Application Programming Interface)를 제공할 수 있다.
다양한 실시예들에 따르면, 메모리(130) 내에서, 복수의 인스트럭션들의 집합인 어플리케이션(146)이 하나 이상 설치될 수 있다. 어플리케이션(146)이 메모리(130) 내에 설치되었다는 것은, 어플리케이션(146)이 메모리(130)에 연결된 프로세서(120)에 의해 실행될 수 있는 형태(format)로 저장되었음을 의미할 수 있다.
다양한 실시예들에 따르면, 디스플레이 모듈(160)는 OLED(Organic Light Emitting Diodes), LCD(Liquid Crystal Display) 및 LED(Light Emitting Diodes) 중 적어도 하나를 이용하여 사용자에게 정보를 시각적으로 출력할 수 있다. 디스플레이 모듈(160)를 통해 출력되는 사용자 인터페이스(User Interface, UI)를 보다 직관적으로 제어할 수 있도록, 전자 장치(101)는 디스플레이 모듈(160) 위에 배치되는 터치 센서 패널(Touch Screen Panel, TSP)(미도시)들을 포함할 수 있다. 터치 센서 패널들은 저항막(resistive film), 정전성 소자(capacitive components), 표면 초음파(surface acoustic wave) 및 적외선(infrared) 중 적어도 하나를 이용하여 디스플레이 모듈(160)를 터치하거나 표시 장치들(160) 위에서 호버링되는 오브젝트(예를 들어, 사용자의 손가락, 스타일러스)의 위치를 탐지할 수 있다.
도 3을 참조하면, 다양한 실시예에 따른 프로그램(140)의 블록도가 도시된다. 프로그램(140)은 어플리케이션(146) 및 데이터베이스(330) 사이의 데이터의 처리를 수행하기 위한 기능을 제공하는 데이터베이스 매니저(211) 및/또는 DB 라이브러리(database library)(310)를 포함할 수 있다. DB 라이브러리(310)는 미들웨어(예: 도 1 내지 도 2의 미들웨어(144))에 포함될 수 있다. 미들웨어는, 데이터베이스(330)와 같은 전자 장치(101)의 하나 이상의 리소스들로부터 제공되는 기능 또는 정보가 어플리케이션(146)에 의해 사용될 수 있도록, 다양한 기능들을 어플리케이션(146)으로 제공할 수 있다. 전자 장치(101)는 데이터베이스 매니저(211) 및/또는 DB 라이브러리(310)에 기반하여, 어플리케이션(146)에 의한 데이터베이스(330)의 생성, 검색 또는 변경을 수행할 수 있다.
다양한 실시예들에 따르면, DB 라이브러리(310)는 어플리케이션(146)에 기반한 데이터베이스(330)의 변경된 데이터(modified data of the database)를 관리하고, 데이터의 변경과 관련된 오류를 탐지 및 복원하는 데이터 로그 및 리커버리 매니저(315)를 포함할 수 있다. 예를 들어, DB 라이브러리(310)에 포함된 데이터베이스(330)의 데이터를 처리하거나 또는 변경하기 위한 기능이 전자 장치(101)에서 실행 중인 어플리케이션(146)에 기반하여 실행된 경우, 전자 장치(101)는 파일 시스템(320)을 통해 데이터베이스(330)내에 포함된 데이터에 접근할 수 있다(may access). 해당 데이터가 파일 시스템(320)으로부터 어플리케이션(146)으로 전달될 때에, 전자 장치(101)는 데이터 로그 및 리커버리 매니저(315)에 기반하여 데이터의 정합성(consistency) 및/또는 무결성(integrity)을 보장할 수 있다.
다양한 실시예들에 따른 전자 장치(101)는 파일 시스템(320)에 기반하여, 예를 들어, 비휘발성 메모리(134)에 기반하는 스토리지(storage)에 저장된 데이터를 관리할 수 있다. 예를 들어, 전자 장치(101)는 파일 시스템(320)을 이용하여 데이터베이스(330)의 데이터(예: 파일)가 저장된 위치를 관리할 수 있다. 파일 시스템(320)은 운영 체제에 포함될 수 있다. 전자 장치(101)는 메모리(130)의 휘발성 메모리(132) 및/또는 비휘발성 메모리(134) 중 적어도 일부를 스토리지로 설정할 수 있다. 스토리지는 전자 장치(101)와 관련된 데이터가 보존되는 저장 영역에 대응할 수 있다. 이하에서는, 메모리는 스토리지 영역과 구별되는 휘발성 메모리(132) 및/또는 비휘발성 메모리(134)의 일부분을 의미할 수 있다. 예를 들어, 메모리는 전자 장치(101)와 관련된 데이터를 처리하기 위한 작업 영역에 대응할 수 있다. 다양한 실시예들에 따른 전자 장치(101)는 데이터베이스(330)에 기반하여, 어플리케이션(146)과 관련된 데이터를 관리할 수 있다. 데이터베이스(330)는 체계화된 데이터의 집합으로, 지정된 리스트 또는 데이터 구조에 기반하여, 스토리지 내에 저장된 데이터의 집합을 의미할 수 있다. 전자 장치(101) 내에 설치된 거의 모든 어플리케이션 및 서비스는 데이터베이스(330)에 기반하여 작동할 수 있다. 이 경우, 전자 장치(101)가 작동하는 상태에서, 서로 다른 복수의 어플리케이션들 및 서비스에 의한 데이터베이스(330)의 접근이 빈번하게 발생될 수 있다. 전자 장치(101)의 스토리지 내에 저장된 데이터베이스(330)의 개수는, 도 3에 도시된 일 실시예에 제한되지 않으며, 복수 개일 수 있다.
다양한 실시예들에 따르면, 전자 장치(101)가 어플리케이션(146)을 오류 없이 실행하기 위하여, 전자 장치(101)는 데이터베이스(330)에 저장된 데이터를 항상 정상적인 상태로 유지하는 데이터 무결성을 보장하면서, 데이터베이스(330)와 관련된 트랜잭션(transaction)의 원자성(atomicity)을 보장할 수 있다. 원자성은, 하나의 트랜잭션에 포함된 모든 동작들에 기반하여 데이터베이스(330)의 데이터를 연산한 결과가 데이터베이스(330)에 모두 반영되거나 전혀 반영되지 않는 것을 의미할 수 있다.
다양한 실시예들에 따르면, 해당 트랜잭션은 데이터베이스(330)의 상태를 변경하기 위하여 수행하는 동작의 단위를 의미할 수 있다. 일 실시예에서, 트랜잭션은 데이터베이스(330)의 데이터와 관련된 동작들의 논리적 작업 단위(LUW, logical units of work)로, 어플리케이션(146) 및 데이터베이스(330) 사이의 상호 작용의 단위일 수 있다. 데이터베이스(330)의 데이터와 관련된 동작은, 예를 들어, OPEN, SELECT, INSERT, DELETE, UPDATE, CLOSE와 같은 질의어(Structured Query Language, SQL)에 기반하여, 데이터베이스(330)에 접근하는 동작을 의미할 수 있다. 일 실시예에서, 하나의 트랜잭션은 데이터베이스(330)의 데이터와 관련된 하나 이상의 동작 및/또는 질의어의 집합을 의미할 수 있다. 일 실시예에서, 트랜잭션에 포함되고 데이터베이스(330)의 데이터와 관련된 동작은, 데이터의 읽기 동작, 데이터의 추가 동작, 데이터의 삭제 동작 및 데이터의 변경 동작을 포함할 수 있다. 트랜잭션의 커밋(commit)은, 트랜잭션에 포함된 데이터와 관련된 모든 동작이 성공적으로 수행되었음을 의미할 수 있다.
다양한 실시예들에 따른 전자 장치(101)는, 데이터베이스 매니저(211) 및/또는 데이터 로그 및 리커버리 매니저(315)에 기반하여, 데이터베이스(330)의 데이터의 무결성 및 원자성을 보장할 수 있다. 예를 들어, 전자 장치(101)는 저널 방식에 기반하여 데이터베이스(330)의 변경된 데이터를 관리함으로써, 데이터베이스(330)의 데이터의 무결성 및 원자성을 보장할 수 있다. 저널 방식은 WAL(Write-Ahead Logging) 방식 및/또는 롤백(Roll-back) 방식을 포함할 수 있다.
일 실시예에서, 전자 장치(101)는 SQLite에 기반하는 데이터베이스(330)를 포함할 수 있다. 전자 장치(101)는 WAL 방식에 따라 SQLite에 기반하는 데이터베이스(330)에 접근함으로써, 트랜잭션의 원자성을 보장할 수 있다.
도 4는 본 개시의 일 실시예에 따른 데이터베이스의 손상을 복구하는 동작을 설명하기 위한 도면이다.
도 4를 참조하면, 일 실시예에 따른 전자 장치(예: 도 1 및 도 3의 전자 장치(101))에서 데이터베이스(예: 도 3의 데이터베이스(330))의 손상 발생 시 수행되는 복구 동작이 예시적으로 도시된다. 전자 장치는 제1 메모리, 제2 메모리 및 프로세서(예: 도 1 및 도 3의 프로세서(120))를 포함할 수 있다.
제1 메모리는 비휘발성 메모리(예: 도 1 및 도 3의 비휘발성 메모리(134))로서, 대용량의 스토리지 장치일 수 있다. 예를 들어, 제1 메모리는 OTPROM(one time programmable ROM), PROM, EPROM, EEPROM, mask ROM, flash ROM, 플래시 메모리, 하드 드라이브, 또는 솔리드 스테이트 드라이브(SSD) 중 적어도 하나를 포함할 수 있다. 제1 메모리는 다양한 데이터들을 포함하는 데이터베이스를 저장할 수 있으며, 프로세서의 동작에 따라 데이터베이스는 트랜잭션에 의해 업데이트될 수 있다.
제2 메모리는 제1 메모리와 다른 속성을 갖는 휘발성 메모리(예: 도 1 및 도 3의 휘발성 메모리(132))일 수 있다. 다양한 실시예에 따르면, 제2 메모리의 적어도 일부 영역은 주 메모리(main memory)로 할당되고, 프로세서는 제1 메모리의 데이터를 제2 메모리에 로딩 또는 임시로 저장하고, 제2 메모리에 임시로 저장된 데이터에 대한 트랜잭션의 연산을 수행할 수 있다. 프로세서는 트랜잭션의 연산 결과를 포함하는 저널 데이터 및 트랜잭션이 반영될 데이터의 주소를 지시하는 메타 데이터를 제2 메모리에 저장할 수 있다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(410) 내지 동작(480)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
동작(410)에서, 전자 장치(프로세서(120)(예: 도 1 내지 도 3의 어플리케이션(146))는 데이터베이스를 오픈(open)하거나, 쿼리(query) 작업을 수행할 수 있다. 이때, 데이터베이스가 손상되어 오픈 또는 쿼리 작업이 완료되지 않을 수 있다. 데이터베이스의 손상은 하드웨어 불량, 어플리케이션 또는 런타임 라이브러리의 오류와 같은 다양한 원인으로 발생할 수 있다. 데이터베이스의 손상은 데이터베이스 엔진(예: libsqlite.so)에서 감지될 수 있으며, 데이터베이스 프레임워크에 손상 이벤트가 수신될 수 있다. 데이터베이스의 손상이 감지되면 동작들(420 내지 450)이 수행될 수 있다.
동작(420)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 고도화된 무결성 검증 기반 복구 동작을 수행할 수 있다. 전자 장치는 데이터베이스의 적어도 일부가 제2 메모리의 사용자 영역으로 로딩되는 DB 캐시와 제2 메모리의 커널 영역으로 로딩되는 OS 캐시를 각각 순차적으로 초기화한 후 데이터베이스의 무결성 확인을 수행함으로써 복구 동작을 수행할 수 있다. 고도화된 무결성 검증 기반 복구 동작에 대해서는 도 5 및 도 6을 통해 상세히 설명한다. 고도화된 무결성 검증 기반 복구 동작이 성공하면, 동작(460)에서 전자 장치는 데이터베이스를 오픈하거나, 쿼리 작업을 수행할 수 있다. 반대로, 고도화된 무결성 검증 기반 복구 동작이 실패하면, 동작(430)이 이어서 수행될 수 있다.
동작(430)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 백업 메타데이터 복구 동작을 수행할 수 있다. 전자 장치는 DB 캐시에 로딩된 메타데이터가 손상된 것에 응답하여 메타데이터의 백업 데이터에 기반한 메타데이터 오버라이딩을 DB 캐시에 수행함으로써 복구 동작을 수행할 수 있다. 백업 메타데이터 복구 동작에 대해서는 도 7 내지 도 10을 통해 상세히 설명한다. 백업 메타데이터 복구 동작이 성공하면 동작(460)이 이어서 수행되고, 반대로 백업 메타데이터 복구 동작이 실패하면 동작(440)이 이어서 수행될 수 있다.
동작(440)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 템플릿 복구 동작을 수행할 수 있다. 전자 장치는 메타데이터에 대한 템플릿 데이터를 DB 캐시에 로딩하고, 템플릿 데이터에 기초한 인-플레이스 업데이트를 통해 메타데이터를 복구할 수 있다. 인-플레이스 업데이트는 DB 캐시에 저장된 메타데이터를 템플릿 데이터에 기초하여 DB 캐시 내에서 직접 업데이트하는 것을 나타낼 수 있다. 템플릿 복구 동작에 대해서는 도 11 및 도 12를 통해 상세히 설명한다. 템플릿 복구 동작이 성공하면 동작(460)이 이어서 수행되고, 반대로 템플릿 복구 동작이 실패하면 동작(450)이 이어서 수행될 수 있다.
동작(450)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 기타 복구 동작을 수행할 수 있다. 전자 장치는 ReIndex 및/또는 VACUUM을 수행하거나, 데이터베이스 관리 시스템의 테이블 페이지 호출 모듈에 기초한 복구 동작을 수행할 수 있다. 여기서, ReIndex는 스키마 기반으로 인덱스를 다시 생성하는 동작을 나타낼 수 있다. 또한, 테이블 페이지 호출 모듈은 데이터베이스 관리 시스템의 특정 테이블의 페이지를 호출하는 모듈로서, 예를 들어, SQLite의 DBdata일 수 있다. 기타 복구 동작에 대해서는 도 13을 통해 상세히 설명한다. 기타 복구 동작이 성공하면 동작(460)이 이어서 수행되고, 반대로 기타 복구 동작이 실패하면 동작(460)이 이어서 수행될 수 있다.
동작(470)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 복구에 실패한 데이터베이스를 초기화할 수 있다. 초기화가 수행되면, 데이터베이스에 저장된 사용자 데이터가 유실될 수 있다. 유실로 인해 연락처, 메시지, 노트와 같은 중요한 사용자 데이터가 삭제될 수 있기 때문에, 데이터베이스가 초기화되지 않도록 여러 단계의 런타임 복구 기법이 제공될 수 있다.
동작(480)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 손상 에러 리포트를 수행할 수 있다. 예를 들어, 손상 에러 리포트에서는 어떤 동작을 수행하던 중 데이터베이스의 손상이 발견되었는지, 여러 단계의 런타임 복구 기법의 수행 결과, 데이터베이스 초기화 동작에 대한 여러 정보를 제한 없이 포함할 수 있다. 손상 에러 리포트는 앞서 설명한 정보를 DB 오픈 또는 쿼리 작업 수행을 요청한 어플리케이션에게 전달하는 것을 나타낼 수 있다.
도 5 및 도 6은 본 개시의 다양한 실시예에 따른 고도화된 무결성 검증 기반 복구 동작을 설명하기 위한 도면이다.
도 5를 참조하면, 전자 장치(예: 도 1 및 도 3의 전자 장치(101))는 메모리의 손상 여부를 판단하고, 무결성 검증을 수행함으로써, 복구 동작을 수행할 수 있다. 데이터베이스 관리 시스템(예: SQLite)은 자체적으로 페이지 캐시 및 DB 동작을 위한 구조체 메모리를 사용하는 데, 해당 메모리의 손상으로 인해 데이터베이스(예: 도 3의 데이터베이스(330))의 손상이 감지될 수 있다. 이 경우는 제1 메모리에 저장된 데이터베이스 자체는 정상이나, 데이터베이스 오픈 및/또는 쿼리 작업 수행을 위해 데이터베이스의 적어도 일부가 로딩된 DB 캐시 및/또는 OS 캐시가 손상된 것일 수 있다. DB 캐시는 데이터베이스의 적어도 일부가 사용자 영역으로 로딩되는 캐시이고, OS 캐시는 데이터베이스의 적어도 일부가 커널 영역으로 로딩되는 캐시일 수 있다.
전자 장치는 DB 캐시 또는 OS 캐시를 초기화하는 동작(510)과 데이터베이스의 무결성 확인 동작(530)을 수행함으로써, 메모리 손상을 복구할 수 있다. DB 캐시와 OS 캐시는 오픈 또는 쿼리 작업이 요청된 데이터베이스의 적어도 일부를 로딩한 것으로, 동작 레이어가 서로 다를 수 있다. OS 캐시는 데이터베이스의 커널 페이지 캐시 및 파일 시스템(예: 도 3의 파일 시스템(320))의 메타데이터를 포함할 수 있다. DB 캐시는 데이터베이스의 적어도 일부가 제2 메모리의 사용자 영역에 로딩되는 캐시이며, OS 캐시는 데이터베이스의 적어도 일부가 제2 메모리의 커널 영역에 로딩되는 캐시일 수 있다. 도 5에 도시된 데이터베이스는 제1 메모리에 저장된 것일 수 있다. 전자 장치는 무결성 확인을 통해 메모리 손상이 복구되었는지 여부를 판단할 수 있다.
도 6은 본 개시의 일 실시예에 따른 전자 장치(예: 도 1 및 도 3의 전자 장치(101))에서 수행되는 고도화된 무결성 검증 기반 복구 동작이 도시된다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(610) 내지 동작(640)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
도 6을 참조하면, 동작(610)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 DB 캐시를 초기화할 수 있다. 예를 들어, 전자 장치는 DB 캐시에 로딩된 데이터를 클리어(clear)하고 다시 데이터베이스(예: 도 3의 데이터베이스(330))의 적어도 일부를 로딩할 수 있다. 이때, 전자 장치는 데이터베이스에 대한 연결을 닫고 다시 열거나, 데이터베이스의 내부 캐시를 모두 정리하는 작업을 수행할 수 있다. 전자 장치는 내부 캐시가 모두 정리되면 새로운 데이터베이스 연결을 생성할 수 있다.
동작(620)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 DB 캐시의 초기화 후 데이터베이스의 무결성 확인을 수행할 수 있다. 예를 들어, DB 캐시를 초기화한 후 데이터베이스의 정합성 확인을 수행하고, 정합성 확인이 성공하면 데이터베이스의 무결성 확인을 수행할 수 있다.
정합성 확인은 다양한 형태로 수행될 수 있다. 예를 들어, 전자 장치는 데이터베이스 손상이 감지된 쿼리를 다시 수행하여 정상적으로 쿼리 결과가 응답되는지를 확인할 수 있다. 전자 장치는 정상적인 쿼리 결과가 응답되면 정합성 확인이 성공한 것으로 판단할 수 있다. 또는, 데이터베이스 손상이 데이터베이스에 대한 오픈 실패로 감지된 경우, 전자 장치는 다시 데이터베이스에 대한 오픈을 실행하여 정상적으로 오픈이 실행되면 정합성 확인이 성공한 것으로 판단할 수 있다.
정합성 확인이 성공하면, 전자 장치는 데이터베이스의 무결성 확인을 수행할 수 있다. 예를 들어, 데이터베이스 관리 시스템이 SQLite인 경우, 전자 장치는 [PRAGMA integrity_check(1);]라는 SQL 구문을 통해 데이터베이스의 무결성 확인을 수행할 수 있다. 데이터베이스의 무결성 확인이 성공하면, 메모리 손상이 복구되어 데이터베이스 손상도 해결된 것으로 판단될 수 있다.
데이터베이스의 정합성 확인이 실패하거나 데이터베이스의 무결성 확인이 실패하면, 전자 장치는 DB 캐시가 아닌 다른 부분의 손상으로 추정하여 동작(630)을 이어서 수행할 수 있다.
동작(630)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 OS 캐시를 초기화할 수 있다. 예를 들어, 전자 장치는 OS 캐시에 로딩된 데이터를 클리어하고 다시 데이터베이스의 적어도 일부를 로딩할 수 있다. 캐시 초기화 동작은 동작(610)에서 설명한 내용이 마찬가지로 적용될 수 있으므로, 보다 자세한 사항은 생략한다.
동작(640)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 OS 캐시의 초기화 후 데이터베이스의 무결성 확인을 수행할 수 있다. 예를 들어, OS 캐시를 초기화한 후 데이터베이스의 정합성 확인을 수행하고, 정합성 확인이 성공하면 데이터베이스의 무결성 확인을 수행할 수 있다. 데이터베이스의 정합성 확인과 무결성 확인 동작은 동작(630)에서 설명한 내용이 마찬가지로 적용될 수 있으므로, 보다 자세한 사항은 생략한다.
OS 캐시를 초기화한 후 데이터베이스의 정합성 확인과 무결성 확인이 모두 성공하면, 메모리 손상이 복구되어 데이터베이스 손상도 해결된 것으로 판단될 수 있다. 반대로 데이터베이스의 정합성 확인이 실패하거나, 데이터베이스의 무결성 확인이 실패하면, 무결성 검증 기반 복구가 실패한 것으로 판단될 수 있다.
도7 내지 도 10은 본 개시의 다양한 실시예에 따른 백업 메타데이터 복구 동작을 설명하기 위한 도면이다.
도 7를 참조하면, 전자 장치(예: 도 1 및 도 3의 전자 장치(101))는 앞서 설명한 고도화된 무결성 검증 기반 복구 동작이 실패하면 백업 메타데이터 복구 동작을 수행할 수 있다. 전자 장치는 손상 전에 미리 백업된 메타데이터를 이용하여 메모리 오버라이딩을 수행함으로써, 데이터베이스(예: 도 3의 데이터베이스(330))를 복구할 수 있다.
전자 장치는 DB 캐시에 로딩된 메타데이터의 손상을 감지하는 동작(710), 백업 데이터가 존재하면 백업 데이터의 무결성 확인을 수행하는 동작(720), 백업 데이터에 기반한 메타데이터 오버라이딩을 DB 캐시에 수행하는 동작(730), DB 캐시에 로딩된 메타데이터를 온-디스크에 반영하는 동작(740)을 수행할 수 있다.
도 8은 본 개시의 일 실시예에 따른 전자 장치(예: 도 1 및 도 3의 전자 장치(101))에서 수행되는 메타데이터의 백업 데이터 작성 동작이 도시된다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(810) 내지 동작(850)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
도 8을 참조하면, 동작(810)에서, 전자 장치(프로세서(120), 예: 도 1 내지 도 3의 어플리케이션(146))는 사용자 요청 또는 시스템 요청에 따라 데이터베이스(예: 도 3의 데이터베이스(330)) 쓰기 트랜잭션을 수행할 수 있다.
동작(820)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 쓰기 트랜잭션에서 메타데이터가 업데이트되는지 여부를 판단할 수 있다. 여기서, 메타데이터는 데이터베이스 헤더, 데이터베이스 스키마처럼 중요 메타데이터일 수 있다. 메타데이터가 업데이트된다면 동작(830)이 이어서 수행되고, 반대로 메타데이터가 업데이트되지 않는다면 동작(840)이 이어서 수행될 수 있다.
동작(830)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 메타데이터의 백업 데이터를 추가로 작성할 수 있다. 백업 데이터는 추후 수행되는 메타데이터 오버라이딩에 활용될 수 있다.
동작(840)에서, 데이터베이스의 쓰기 트랜잭션이 완료되면, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 해당 트랜잭션에 포함된 데이터와 관련된 모든 동작이 성공적으로 수행되었음을 나타내는 데이터베이스 트랜잭션 커밋(commit)이 생성될 수 있다.
쓰기 트랜잭션이 실패한 경우, 동작(850)에서 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 메타데이터의 백업 데이터를 이전 상태로 롤백(rollback)할 수 있다. 이 경우, 백업 메타데이터 또한 이전 상태로 돌아갈 수 있으며, 이를 통해 백업 메타데이터는 현재 데이터베이스의 메타데이터와 동일하게 유지될 수 있다.
도 9는 본 개시의 일 실시예에 따른 전자 장치(예: 도 1 및 도 3의 전자 장치(101))에서 수행되는 메타데이터 오버라이딩 동작이 도시된다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(910) 내지 동작(940)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
도 9를 참조하면, 동작(910)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 DB 캐시 내 메타데이터가 손상된 것으로 판단되면, 해당 메타데이터의 백업 데이터가 존재하는지 여부를 판단할 수 있다. 메타데이터의 백업 데이터가 존재하지 않다면 백업 메타데이터 복구 동작이 종료될 수 있으며, 메타데이터의 백업 데이터가 존재한다면 동작(920)이 이어서 수행될 수 있다.
동작(920)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 백업 데이터의 무결성 확인을 수행할 수 있다. 예를 들어, 전자 장치는 백업 데이터의 정합성 확인을 수행하고, 정합성 확인이 성공하면 백업 데이터의 무결성 확인을 수행할 수 있다. 예를 들어, 백업 데이터가 별도의 파일로 작성된 경우 정합성 확인은 검사합(checksum) 방식에 따라 수행될 수 있다. 또한, 정합성 확인과 무결성 확인에 대해서는 앞선 설명들이 마찬가지로 적용될 수 있으므로, 보다 자세한 설명은 생략한다. 메타데이터의 정합성 확인과 무결성 확인이 모두 성공하면 동작(930)이 이어서 수행되고, 그렇지 않다면 백업 메타데이터 복구 동작이 종료될 수 있다.
동작(930)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 백업 데이터를 인-메모리에 로딩할 수 있으며, 이를 메타데이터 오버라이딩 기법이라고 지칭할 수 있다. 백업 데이터를 인-메모리에 로딩한다는 것은 백업 데이터를 DB 캐시에 로딩한다는 것을 나타낼 수 있다. 예를 들어, 전자 장치는 비휘발성 메모리(예: 도 1 및 도 3의 비휘발성 메모리(134))에 저장된 백업 데이터를 DB 캐시에 로딩할 수 있다. 메타데이터 오버라이딩을 통해, 데이터베이스 헤더 또는 데이터베이스 스키마를 로딩하는 동작으로 백업 데이터에서 메타데이터를 추출하여 런타임으로 사용할 수 있다.
메타데이터 오버라이딩이 성공적으로 수행되면 동작(940)이 이어서 수행되고, 그렇지 않다면 백업 메타데이터 복구 동작이 종료될 수 있다.
메타데이터 오버라이딩이 성공적으로 수행되었다면, 데이터베이스(예: 도 3의 데이터베이스(330))에 대한 데이터 변경이나 추가는 불가능하더라도 제1 메모리에 저장된 데이터를 읽는 동작은 정상적으로 수행될 수 있다. 이를 통해, 읽기 전용의 데이터베이스 연결이 사용될 수 있다. 데이터베이스에 대한 데이터 변경이나 추가를 수행하기 위해서는 현재 손상된 데이터베이스를 복구하는 동작(940)이 수행될 수 있다.
동작(940)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 백업 데이터를 이용하여 데이터베이스 복구를 수행할 수 있다. 전자 장치는 인-플레이스 업데이트에 기초하여 데이터베이스 복구를 수행할 수 있으며, 이에 대해서는 도 10을 통해 상세히 설명한다.
도 10은 본 개시의 일 실시예에 따른 전자 장치(예: 도 1 및 도 3의 전자 장치(101))에서 수행되는 백업 데이터를 이용한 메타데이터의 인-플레이스 업데이트 동작이 도시된다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(1010) 내지 동작(1030)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
도 10을 참조하면, 동작(1010)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 인-플레이스 업데이트를 수행하기 위해 배타적 락을 획득할 수 있다. 배타적 락은 다른 데이터베이스의 연결이 사용되는 것을 막을 수 있다. 배타적 락은 모든 읽기(read)와 쓰기(write)를 사용하지 못하게 하는 락일 수 있다.
동작(1020)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 배타적 락을 획득한 상태에서 인-플레이스 업데이트를 통해 메타데이터 업데이트를 수행할 수 있다. 인-플레이스 업데이트는 데이터베이스(예: 도 3의 데이터베이스(330)) 내에 손상된 메타데이터의 동일한 위치에 백업 데이터에서 추출한 정상적인 메타데이터를 재작성하는 작업일 수 있다. 이러한 인-플레이스 업데이트를 통해, 데이터베이스의 손상이 해결될 수 있다.
동작(1030)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 인-플레이스 업데이트가 완료되면 배타적 락을 반환할 수 있다.
도 11 및 도 12는 본 개시의 다양한 실시예에 따른 템플릿 복구 동작을 설명하기 위한 도면이다.
도 11을 참조하면, 전자 장치(예: 도 1 및 도 3의 전자 장치(101))는 앞서 설명한 백업 메타데이터 복구 동작이 실패하면 템플릿 복구 동작을 수행할 수 있다. 예를 들어, 메타데이터의 백업 데이터가 존재하지 않거나, 메타데이터의 무결성 확인이 실패하는 경우처럼 백업 메타데이터 복구 동작이 실패하는 경우에 템플릿 복구 동작이 수행될 수 있다.
데이터베이스(예: 도 3의 데이터베이스(330))의 헤더(예: 데이터베이스 헤더 및 페이지 헤더)는 미리 지정된 파일 포맷을 가질 수 있다. 전자 장치는 해당 파일 포맷을 이용하여 데이터베이스 또는 페이지의 상태에 맞는 템플릿을 생성하여 데이터베이스 복구가 가능한지 시도할 수 있다.
전자 장치는 메타데이터에 대한 템플릿 데이터에 기반한 템플릿 오버라이딩을 DB 캐시에 수행하는 동작(1110) 및 DB 캐시에 로딩된 템플릿 데이터의 무결성 확인을 수행하는 동작(1120)을 수행할 수 있다. 전자 장치는 템플릿 데이터의 무결성 확인이 성공하면 인-플레이스 업데이트에 기반하여 DB 캐시에 로딩된 템플릿 데이터를 제1 메모리에 저장된 데이터베이스에 반영함으로써, 데이터베이스를 복구할 수 있다.
도 12는 본 개시의 일 실시예에 따른 전자 장치(예: 도 1 및 도 3의 전자 장치(101))에서 수행되는 템플릿 복구 동작이 도시된다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(1210) 내지 동작(1260)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
도 12를 참조하면, 동작(1210)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스 헤더 또는 데이터베이스 페이지 헤더의 손상이 존재하는지 여부를 런타임에서 판단할 수 있다. 데이터베이스 헤더의 손상이 존재한다면 동작(1220)이 이어서 수행되고, 반대로 데이터베이스 헤더의 손상이 존재하지 않는다면 동작(1240)이 이어서 수행될 수 있다.
동작(1220)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스(예: 도 3의 데이터베이스(330))의 상태를 판단할 수 있다. 예를 들어, 전자 장치는 데이터베이스 사이즈를 파일 사이즈로 확인하고, 저널 모드를 WAL 파일 유무로 판단할 수 있다. 전자 장치는 현재 파일 상태에서 판단할 수 없는 정보를 기본 헤더 데이터로 적용하여 해당 파일이 정상적으로 동작할 수 있는지 여부를 판단할 수 있다.
동작(1230)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스 상태에 기초하여 데이터베이스의 헤더 데이터에 대한 템플릿 데이터를 생성할 수 있다. 전자 장치는 생성된 템플릿 데이터의 무결성 확인을 수행하고, 템플릿 데이터의 무결성 확인이 성공하면 인-플레이스 업데이트를 통해 데이터베이스에 반영함으로써, 데이터베이스를 복구할 수 있다.
동작(1240)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 페이지 헤더의 손상이 존재하는지 여부를 런타임에서 판단할 수 있다. 페이지 헤더의 손상이 존재한다면 동작(1250)이 이어서 수행되고, 반대로 페이지 헤더의 손상이 존재하지 않는다면 템플릿 복구 동작 실패한 것으로 판단될 수 있다.
동작(1250)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 페이지 상태를 판단할 수 있다. 예를 들어, 전자 장치는 페이지 타입, 부모 페이지(parent page)에 대한 정보를 확인할 수 있다. 전자 장치는 현재 페이지 상태에서 판단할 수 없는 정보를 기본 헤더 데이터로 적용하여 해당 파일이 정상적으로 동작할 수 있는지 여부를 판단할 수 있다.
동작(1260)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 페이지 상태에 기초하여 페이지의 헤더 데이터에 대한 템플릿 데이터를 생성할 수 있다. 전자 장치는 생성된 템플릿 데이터의 무결성 확인을 수행하고, 템플릿 데이터의 무결성 확인이 성공하면 인-플레이스 업데이트를 통해 데이터베이스에 반영함으로써, 데이터베이스를 복구할 수 있다.
이처럼, 전자 장치는 순차적으로 데이터베이스 헤더와 페이지 헤더의 손상 여부를 판단함으로써, 각 헤더에 맞는 템플릿 데이터를 생성해서 데이터베이스 복구에 활용할 수 있다.
도 13은 본 개시의 일 실시예에 따른 기타 복구 동작을 설명하기 위한 도면이다.
도 13을 참조하면, 전자 장치(예: 도 1 및 도 3의 전자 장치(101))는 앞서 설명한 템플릿 복구 동작이 실패하면 기타 복구 동작을 수행할 수 있다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(1310) 내지 동작(1380)은 전자 장치의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
동작(1310)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스(예: 도 3의 데이터베이스(330))가 정상적으로 오픈(open)되었는지 여부를 판단할 수 있다. 앞서 설명한 복구 동작들이 모두 실패할 경우, 전자 장치는 데이터베이스 관리 시스템(예: SQLite)에서 제공하는 다양한 기법들을 이용하여 데이터베이스 복구를 시도할 수 있다. 이러한 기법들은 데이터베이스 연결이 정상적으로 오픈되어 쿼리 작업을 수행할 수 있는 상태에서 진행될 수 있기 때문에, 데이터베이스가 정상적으로 오픈되었는지 여부가 선행적으로 판단될 수 있다.
데이터베이스가 오픈되어 쿼리 작업을 정상적으로 수행할 수 있는 상태라면 손상에 대한 정보가 분석될 수 있고, 동작(1320)이 이어서 수행될 수 있다. 반대로 데이터베이스가 오픈되지 않아 쿼리 작업을 정상적으로 수행할 수 없는 상태라면 기타 복구 동작이 수행될 수 없고, 도 4의 동작(470)에서 설명한 데이터베이스 초기화가 이어서 수행될 수 있다.
동작(1320)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스의 인덱스(index)의 손상 여부를 판단할 수 있다. 데이터베이스의 인덱스가 손상된 것으로 판단되면, 동작(1330)이 이어서 수행될 수 있다. 반대로 데이터베이스의 인덱스가 손상되지 않았다면, 동작(1340)이 이어서 수행될 수 있다.
동작(1330)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스에 대해 리인덱스(reindex)를 수행할 수 있다. 리인덱스는 현재 인덱스를 무효화하고 인덱스를 새롭게 생성하는 작업일 수 있다.
동작(1340)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스에 대한 프리리스트(freelist) 또는 테이블 트리 맵의 손상 여부를 판단할 수 있다. 프리리스트(freelist) 또는 테이블 트리 맵이 손상되었다면 동작(1360)이 이어서 수행되고, 그렇지 않다면 동작(1350)이 이어서 수행될 수 있다. 여기서, 프리리스트는 데이터베이스 내 사용되지 않는 페이지에 대한 리스트를 나타낼 수 있다. 테이블 트리 맵은 테이블 트리를 관리하기 위한 맵핑 정보를 나타내는 것으로, 예를 들어, SQLite의 ptr map 엔트리일 수 있다.
동작(1350)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 사용하지 않은 페이지의 손상 여부를 판단할 수 있다. 사용하지 않은 페이지가 손상되었다면 동작(1360)이 이어서 수행되고, 그렇지 않다면 동작(1370)이 이어서 수행될 수 있다.
동작(1360)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스에 대해 VACUUM을 수행할 수 있다. VACUUM이 실행되면, 데이터베이스의 내용을 임시 데이터베이스에 한 번 옮겼다가 다시 되돌리는 처리가 수행될 수 있다. 그렇게 함으로써 빈공간을 없애는 동시에 데이터를 순차적으로 저장하여 데이터베이스를 재구성하는 작업이 수행될 수 있다.
리인덱스 또는 VACUUM으로 해결되지 않는 손상인 경우라면, 동작(1370)에서 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스 관리 시스템의 테이블 페이지 호출 모듈에 기초하여 데이터베이스에서 데이터를 추출할 수 있다. 테이블 페이지 호출 모듈은 데이터베이스 관리 시스템에서 제공하는 가상 테이블(virtual table) 기능을 이용한 기법으로, 각 페이지의 레코드들을 파싱해서 쿼리 결과로 전달해주는 기능일 수 있으며, 예를 들어, SQLite의 DBdata일 수 있다.
동작(1380)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 추출된 데이터에 기초하여 새로운 데이터베이스를 생성할 수 있다. 예를 들어, 전자 장치는 쿼리 후 insert를 수행하는 방식으로 새로운 데이터베이스를 작성할 수 있다.
도 13에 도시된 기타 복구 동작으로도 데이터베이스 손상이 복구될 수 없는 경우에는 도 4의 동작(470)에서 설명한 데이터베이스 초기화가 이어서 수행될 수 있다.
도 14는 본 개시의 일 실시예에 따른 전자 장치의 동작 방법을 나타낸 도면이다.
이하 실시예에서 각 동작들은 순차적으로 수행될 수도 있으나, 반드시 순차적으로 수행되는 것은 아니다. 예를 들어, 각 동작들의 순서가 변경될 수도 있으며, 적어도 두 동작들이 병렬적으로 수행될 수도 있다. 동작(1410) 내지 동작(1440)은 전자 장치(예: 도 1 및 도 3의 전자 장치(101))의 적어도 하나의 구성요소(예: 도 1 및 도 3의 프로세서(120))에 의해 수행될 수 있다.
도 14를 참조하면, 동작(1410)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 비휘발성의 제1 메모리에 저장된 데이터베이스(예: 도 3의 데이터베이스(330))의 손상 여부를 판단할 수 있다.
동작(1420)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스가 손상된 것으로 판단되면, 데이터베이스의 적어도 일부가 로딩되는 DB 캐시를 초기화한 후 데이터베이스의 제1 무결성 확인을 수행할 수 있다.
동작(1430)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스의 제1 무결성 확인이 실패하면, 데이터베이스의 적어도 일부가 로딩되는 OS 캐시를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행할 수 있다.
동작(1440)에서, 전자 장치(프로세서(120)(예: 데이터베이스 관리 시스템)는 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면, 데이터베이스에 대한 작업을 수행할 수 있다.
데이터베이스의 제1 무결성 확인 및 제2 무결성 확인이 모두 실패한 경우에는 다음 복구 동작들이 이어서 수행될 수 있으며, 다음 복구 동작들에 대해서는 도 1 내지 도 13을 통해 전술한 사항들이 그대로 적용되므로, 보다 상세한 설명은 생략한다.
일 실시예에 따르면, 전자 장치의 동작 방법은 전자 장치의 비휘발성의 제1 메모리에 저장된 데이터베이스의 손상 여부를 판단하는 동작, 데이터베이스가 손상된 것으로 판단되면, 데이터베이스의 적어도 일부가 제2 메모리의 사용자 영역으로 로딩된 DB 캐시를 초기화한 후 데이터베이스의 제1 무결성 확인을 수행하는 동작, 데이터베이스의 제1 무결성 확인이 실패하면, 데이터베이스의 적어도 일부가 제2 메모리의 커널 영역으로 로딩된 OS 캐시를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행하는 동작 및 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면, 데이터베이스 파일에 대한 작업을 수행하는 동작을 포함할 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법에서 데이터베이스의 제1 무결성 확인을 수행하는 동작은 데이터베이스의 제1 정합성 확인을 수행하고, 제1 정합성 확인이 성공하면 데이터베이스의 제1 무결성 확인을 수행할 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법에서 데이터베이스의 제1 무결성 확인을 수행하는 동작은 손상이 감지되는 경우에 응답하여, DB 캐시를 클리어한 후 데이터베이스의 적어도 일부를 다시 로딩함으로써, DB 캐시를 초기화할 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법은 데이터베이스의 제2 무결성 확인이 실패하면, DB 캐시에 로딩된 메타데이터의 손상 여부를 판단하는 동작 및 메타데이터가 손상된 것으로 판단되면, 메타데이터의 백업 데이터에 기반한 메타데이터 오버라이딩을 DB 캐시에 수행하는 동작을 더 포함할 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법에서 메타데이터 오버라이딩을 DB 캐시에 수행하는 동작은 메타데이터가 손상된 것으로 판단되면, 메타데이터의 백업 데이터가 존재하는지 여부를 판단하는 동작, 백업 데이터가 존재하면, 백업 데이터의 제3 무결성 확인을 수행하는 동작, 백업 데이터의 제3 무결성 확인이 성공하면, 백업 데이터를 DB 캐시에 로딩하는 동작 및 백업 데이터에 기초한 인-플레이스 업데이트(in-place update)를 통해 메타데이터를 복구하는 동작을 포함할 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법에서 인-플레이스 업데이트는 데이터베이스에 대한 배타적 락(exclusive lock)을 획득한 상태에서 손상된 메타데이터의 동일한 위치에 백업 데이터에서 추출된 메타데이터를 재작성함으로써 수행되고, 배타적 락은 인-플레이스 업데이트가 완료되면 반환될 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법에서 백업 데이터는 데이터베이스에 대한 쓰기 트랜잭션 수행 시, 메타데이터가 업데이트되는지 여부를 판단하는 동작, 메타데이터가 업데이트된다면, 메타데이터에 대한 백업 데이터를 생성하는 동작 및 백업 데이터에 대한 생성이 실패하면, 백업 데이터를 이전 상태로 롤백하는 동작에 기반하여 결정될 수 있다.
일 실시예에 따르면, 전자 장치의 동작 방법은 메타데이터의 백업 데이터가 존재하지 않거나, 메타데이터의 제3 무결성 확인이 실패하면, 메타데이터에 대한 템플릿 데이터를 DB 캐시에 로딩하는 동작 및 템플릿 데이터에 기초한 인-플레이스 업데이트를 통해 메타데이터를 복구하는 동작을 더 포함할 수 있다.
도 15는 본 개시의 일 실시예에 따른 전자 장치를 나타낸 도면이다.
도 15를 참조하면, 일 실시예에 따른 전자 장치(1500)(예: 도 1 및 도 3의 전자 장치(101))는 제1 메모리(1510), 제2 메모리(1520) 및 프로세서(1530)(예: 도 1 및 도 3의 프로세서(120))를 포함할 수 있다.
일 실시예에 따른 전자 장치(1500)는 사용자 단말로 구현될 수 있다. 예를 들어, 사용자 단말은 휴대폰, 스마트 폰, 태블릿, 랩탑, 퍼스널 컴퓨터, 또는 전자북 장치와 같은 다양한 컴퓨팅 장치, 스마트 시계, 스마트 안경, HMD(Head-Mounted Display), 또는 스마트 의류와 같은 다양한 웨어러블 기기, 스마트 스피커, 스마트 TV, 또는 스마트 냉장고와 같은 다양한 가전장치, 스마트 자동차, 스마트 키오스크, IoT(Internet of Things) 기기, WAD(Walking Assist Device), 드론, 또는 로봇을 포함할 수 있다.
제1 메모리(1510)는 비휘발성 메모리(예: 도 1 및 도 3의 비휘발성 메모리(134))로서, 대용량의 스토리지 장치일 수 있다. 제1 메모리(1510)는 다양한 데이터들을 포함하는 데이터베이스(예: 도 3의 데이터베이스(330))를 저장할 수 있으며, 프로세서(1530)의 동작에 따라 데이터베이스는 트랜잭션에 의해 업데이트될 수 있다.
제2 메모리(1520)는 제1 메모리(1510)와 다른 속성을 갖는 휘발성 메모리(예: 도 1 및 도 3의 휘발성 메모리(132))일 수 있다. 다양한 실시예에 따르면, 제2 메모리(1520)의 적어도 일부 영역은 주 메모리(main memory)로 할당되고, 프로세서(1530)는 제1 메모리(1510)의 데이터를 제2 메모리(1520)에 로딩 또는 임시로 저장하고, 제2 메모리(1520)에 임시로 저장된 데이터에 대한 트랜잭션의 연산을 수행할 수 있다.
프로세서(1530)는 데이터베이스의 손상 여부를 판단하고, 데이터베이스가 손상된 것으로 판단되면 데이터베이스의 적어도 일부가 로딩되는 DB 캐시를 초기화한 후 데이터베이스의 제1 무결성 확인을 수행하고, 데이터베이스의 제1 무결성 확인이 실패하면 데이터베이스의 적어도 일부가 로딩되는 OS 캐시를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행하고, 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면 데이터베이스 파일에 대한 작업을 수행할 수 있다. 여기서, DB 캐시는 데이터베이스의 적어도 일부가 제2 메모리(1520)의 사용자 영역으로 로딩되는 캐시이고, OS 캐시는 데이터베이스의 적어도 일부가 제2 메모리(1520)의 커널 영역으로 로딩되는 캐시일 수 있다.
그 밖에, 전자 장치(1500)에 관해서는 상술된 동작을 처리할 수 있다.
일 실시예에 따르면, 전자 장치(1500)는 데이터베이스를 저장하는 비휘발성의 제1 메모리(1510), 휘발성의 제2 메모리(1520) 및 제1 메모리(1510) 및 제2 메모리(1520)와 작동적으로 연결된 프로세서(1530)를 포함할 수 있다. 프로세서(1530)는 데이터베이스의 손상(corruption) 여부를 판단하고, 데이터베이스가 손상된 것으로 판단되면, 데이터베이스의 적어도 일부가 제2 메모리(1520)의 사용자 영역으로 로딩된 DB 캐시(database cache)를 초기화한 후 데이터베이스의 제1 무결성 확인(first integrity check)을 수행하고, 데이터베이스의 제1 무결성 확인이 실패하면, 데이터베이스의 적어도 일부가 제2 메모리(1520)의 커널 영역으로 로딩된 OS 캐시(operating system cache)를 초기화한 후 데이터베이스의 제2 무결성 확인을 수행하고, 데이터베이스의 제1 무결성 확인 또는 제2 무결성 확인이 성공하면, 데이터베이스 파일에 대한 작업을 수행할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 DB 캐시를 초기화한 후 데이터베이스의 제1 정합성 확인(first consistency check)을 수행하고, 제1 정합성 확인이 성공하면 데이터베이스의 제1 무결성 확인을 수행할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 손상이 감지되는 경우에 응답하여, DB 캐시를 클리어한 후 데이터베이스의 적어도 일부를 다시 로딩함으로써, DB 캐시를 초기화할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 데이터베이스의 제2 무결성 확인이 실패하면, DB 캐시에 로딩된 메타데이터의 손상 여부를 판단하고, 메타데이터가 손상된 것으로 판단되면, 메타데이터의 백업 데이터에 기반한 메타데이터 오버라이딩(overriding)을 DB 캐시에 수행할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 메타데이터가 손상된 것으로 판단되면, 메타데이터의 백업 데이터가 존재하는지 여부를 판단하고, 백업 데이터가 존재하면, 백업 데이터의 제3 무결성 확인 을 수행하고, 백업 데이터의 제3 무결성 확인이 성공하면, 백업 데이터를 DB 캐시에 로딩하고, 백업 데이터에 기초한 인-플레이스 업데이트(in-place update)를 통해 메타데이터를 복구할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 인-플레이스 업데이트는 데이터베이스에 대한 배타적 락(exclusive lock)을 획득한 상태에서 손상된 메타데이터의 동일한 위치에 백업 데이터에서 추출된 메타데이터를 재작성함으로써 수행되고, 배타적 락은 인-플레이스 업데이트가 완료되면 반환될 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 백업 데이터는 데이터베이스에 대한 쓰기 트랜잭션 수행 시, 메타데이터가 업데이트되는지 여부를 판단하는 동작, 메타데이터가 업데이트된다면, 메타데이터에 대한 백업 데이터를 생성하는 동작 및 백업 데이터에 대한 생성이 실패하면, 백업 데이터를 이전 상태로 롤백하는 동작에 기반하여 결정될 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 메타데이터의 백업 데이터가 존재하지 않거나, 메타데이터의 제3 무결성 확인이 실패하면, 메타데이터에 대한 템플릿 데이터를 DB 캐시에 로딩하고, 템플릿 데이터에 기초한 인-플레이스 업데이트를 통해 메타데이터를 복구할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 메타데이터의 백업 데이터가 존재하지 않거나, 백업 데이터의 제3 무결성이 실패하면, 데이터베이스의 헤더 데이터의 손상 여부를 판단하고, 데이터베이스의 헤더 데이터가 손상된 것으로 판단되면, 데이터베이스의 상태에 기초하여 데이터베이스의 헤더 데이터에 대한 템플릿 데이터를 생성하고, 데이터베이스의 헤더 데이터가 손상되지 않은 것으로 판단되면, 데이터베이스 내 페이지의 헤더 데이터의 손상 여부를 판단하고, 페이지의 헤더 데이터가 손상된 것으로 판단되면, 페이지의 상태에 기초하여 페이지의 헤더 데이터에 대한 템플릿 데이터를 생성할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 템플릿 데이터에 기반하여 메타데이터의 복구가 실패하면, 데이터베이스가 정상적으로 오픈(open)되었는지 여부를 판단하고, 데이터베이스가 정상적으로 오픈되었으면, 데이터베이스의 인덱스(index)의 손상 여부를 판단하고, 데이터베이스의 인덱스가 손상된 것으로 판단되면, 데이터베이스에 대해 리인덱스(reindex)를 수행하고, 데이터베이스의 인덱스가 손상되지 않은 것으로 판단되면, 데이터베이스에 대한 프리리스트(freelist) 또는 테이블 트리 맵의 손상 여부 및/또는 사용하지 않은 페이지의 손상 여부를 판단하고, 프리리스트 또는 테이블 트리 맵이 손상되거나, 사용하지 않은 페이지가 손상된 것으로 판단되면, 데이터베이스에 대해 VACUUM을 수행할 수 있다.
일 실시예에 따르면, 전자 장치(1500)에서 프로세서(1530)는 프리리스트 또는 테이블 트리 맵이 손상되지 않고, 사용하지 않은 페이지가 손상되지 않은 것으로 판단되면, 데이터베이스 관리 시스템의 테이블 페이지 호출 모듈에 기초하여 데이터베이스에서 데이터를 추출하여 새로운 데이터베이스를 생성할 수 있다.
본 개시가 다양한 실시예를 참조하여 도시되고 설명되었지만, 본 기술분야의 통상의 지식을 가진 자라면 첨부된 특허청구범위 및 그 균등물에 의해 정의된 바와 같이 본 개시의 사상과 범위를 벗어나지 않으면서 형태 및 세부사항의 다양한 변경이 이루어질 수 있음을 이해할 것이다.

Claims (15)

  1. 전자 장치에 있어서,
    데이터베이스를 저장하는 비휘발성의 제1 메모리;
    휘발성의 제2 메모리; 및
    상기 제1 메모리 및 상기 제2 메모리와 작동적으로 연결된(operably connected to) 프로세서
    를 포함하고,
    상기 프로세서는
    상기 데이터베이스의 손상(corruption) 여부를 판단하고,
    상기 데이터베이스가 손상된 것으로 판단되면, 상기 데이터베이스의 적어도 일부가 상기 제 2 메모리의 사용자 영역(user space)으로 로딩된 DB 캐시(database cache)를 초기화한 후 상기 데이터베이스의 제1 무결성 확인(first integrity check)을 수행하고,
    상기 데이터베이스의 상기 제1 무결성 확인이 실패하면, 상기 데이터베이스의 적어도 일부가 상기 제 2 메모리의 커널 영역(kernel space)으로 로딩된 OS 캐시(operating system cache)를 초기화한 후 상기 데이터베이스의 제2 무결성 확인을 수행하고,
    상기 데이터베이스의 상기 제1 무결성 확인 또는 상기 제2 무결성 확인이 성공하면, 상기 데이터베이스 파일에 대한 작업을 수행하는,
    전자 장치.
  2. 제1항에 있어서,
    상기 프로세서는
    상기 DB 캐시를 초기화한 후 상기 데이터베이스의 제1 정합성 확인(first consistency check)을 수행하고, 상기 제1 정합성 확인이 성공하면 상기 데이터베이스의 상기 제1 무결성 확인을 수행하는,
    전자 장치.
  3. 제1항에 있어서,
    상기 프로세서는
    상기 손상이 감지되는 경우에 응답하여, 상기 DB 캐시를 클리어한 후 상기 데이터베이스의 적어도 일부를 다시 로딩함으로써, 상기 DB 캐시를 초기화하는,
    전자 장치.
  4. 제1항에 있어서,
    상기 프로세서는
    상기 데이터베이스의 제2 무결성 확인이 실패하면, 상기 DB 캐시에 로딩된 메타데이터의 손상 여부를 판단하고,
    상기 메타데이터가 손상된 것으로 판단되면, 상기 메타데이터의 백업 데이터에 기반한 메타데이터 오버라이딩(overriding)을 상기 DB 캐시에 수행하는,
    전자 장치.
  5. 제4항에 있어서,
    상기 프로세서는
    상기 메타데이터가 손상된 것으로 판단되면, 상기 메타데이터의 백업 데이터가 존재하는지 여부를 판단하고,
    상기 백업 데이터가 존재하면, 상기 백업 데이터의 제3 무결성 확인을 수행하고,
    상기 백업 데이터의 제3 무결성 확인이 성공하면, 상기 백업 데이터를 상기 DB 캐시에 로딩하고,
    상기 백업 데이터에 기초한 인-플레이스 업데이트(in-place update)를 통해 상기 메타데이터를 복구하는,
    전자 장치.
  6. 제5항에 있어서,
    상기 인-플레이스 업데이트는 상기 데이터베이스에 대한 배타적 락(exclusive lock)을 획득한 상태에서 상기 손상된 메타데이터의 동일한 위치에 상기 백업 데이터에서 추출된 메타데이터를 재작성함으로써 수행되고,
    상기 배타적 락은 상기 인-플레이스 업데이트가 완료되면 반환되는,
    전자 장치.
  7. 제4항에 있어서,
    상기 메타데이터의 상기 백업 데이터는
    상기 데이터베이스에 대한 쓰기 트랜잭션 수행 시, 상기 메타데이터가 업데이트되는지 여부를 판단하는 동작;
    상기 메타데이터가 업데이트된다면, 상기 메타데이터에 대한 백업 데이터를 생성하는 동작; 및
    상기 백업 데이터에 대한 생성이 실패하면, 상기 백업 데이터를 이전 상태로 롤백하는 동작
    에 기반하여 결정되는,
    전자 장치.
  8. 제4항에 있어서,
    상기 프로세서는
    상기 메타데이터의 백업 데이터가 존재하지 않거나, 상기 메타데이터의 제3 무결성 확인이 실패하면, 상기 메타데이터에 대한 템플릿 데이터를 상기 DB 캐시에 로딩하고,
    상기 템플릿 데이터에 기초한 인-플레이스 업데이트를 통해 상기 메타데이터를 복구하는,
    전자 장치.
  9. 제8항에 있어서,
    상기 프로세서는
    상기 메타데이터의 백업 데이터가 존재하지 않거나, 상기 백업 데이터의 제3 무결성이 실패하면, 상기 데이터베이스의 헤더 데이터의 손상 여부를 판단하고,
    상기 데이터베이스의 헤더 데이터가 손상된 것으로 판단되면, 상기 데이터베이스의 상태에 기초하여 상기 데이터베이스의 헤더 데이터에 대한 템플릿 데이터를 생성하고,
    상기 데이터베이스의 헤더 데이터가 손상되지 않은 것으로 판단되면, 상기 데이터베이스 내 페이지의 헤더 데이터의 손상 여부를 판단하고,
    상기 페이지의 헤더 데이터가 손상된 것으로 판단되면, 상기 페이지의 상태에 기초하여 상기 페이지의 헤더 데이터에 대한 템플릿 데이터를 생성하는,
    전자 장치.
  10. 제8항에 있어서,
    상기 프로세서는
    상기 템플릿 데이터에 기반하여 상기 메타데이터의 복구가 실패하면, 상기 데이터베이스가 정상적으로 오픈(open)되었는지 여부를 판단하고,
    상기 데이터베이스가 정상적으로 오픈되었으면, 상기 데이터베이스의 인덱스(index)의 손상 여부를 판단하고,
    상기 데이터베이스의 인덱스가 손상된 것으로 판단되면, 상기 데이터베이스에 대해 리인덱스(reindex)를 수행하고,
    상기 데이터베이스의 인덱스가 손상되지 않은 것으로 판단되면, 상기 데이터베이스에 대한 프리리스트(freelist) 또는 테이블 트리 맵의 손상 여부 및/또는 사용하지 않은 페이지의 손상 여부를 판단하고,
    상기 프리리스트 또는 테이블 트리 맵이 손상되거나, 상기 사용하지 않은 페이지가 손상된 것으로 판단되면, 상기 데이터베이스에 대해 VACUUM을 수행하는,
    전자 장치.
  11. 제10항에 있어서,
    상기 프로세서는
    상기 데이터베이스가 정상적으로 오픈되었는지 여부를 판단하고, 상기 데이터베이스를 사용할 수 있는 데이터베이스 관리 시스템의 테이블 페이지 호출 모듈이 존재하는 경우, 상기 테이블 페이지 호출 모듈에 기초하여 상기 데이터베이스에서 데이터를 추출하여 새로운 데이터베이스를 생성하는,
    전자 장치.
  12. 전자 장치의 동작 방법에 있어서,
    상기 전자 장치의 비휘발성의 제1 메모리에 저장된 데이터베이스의 손상 여부를 판단하는 동작;
    상기 데이터베이스가 손상된 것으로 판단되면, 상기 데이터베이스의 적어도 일부가 상기 전자 장치의 휘발성의 제2 메모리의 사용자 영역으로 로딩된 DB 캐시를 초기화한 후 상기 데이터베이스의 제1 무결성 확인을 수행하는 동작;
    상기 데이터베이스의 상기 제1 무결성 확인이 실패하면, 상기 데이터베이스의 적어도 일부가 상기 제2 메모리의 커널 영역으로 로딩된 OS 캐시를 초기화한 후 상기 데이터베이스의 제2 무결성 확인을 수행하는 동작; 및
    상기 데이터베이스의 상기 제1 무결성 확인 또는 상기 제2 무결성 확인이 성공하면, 상기 데이터베이스 파일에 대한 작업을 수행하는 동작
    을 포함하는,
    전자 장치의 동작 방법.
  13. 제12항에 있어서,
    상기 데이터베이스의 제2 무결성 확인이 실패하면, 상기 DB 캐시에 로딩된 메타데이터의 손상 여부를 판단하는 동작; 및
    상기 메타데이터가 손상된 것으로 판단되면, 상기 메타데이터의 백업 데이터에 기반한 메타데이터 오버라이딩을 상기 DB 캐시에 수행하는 동작
    을 더 포함하고,
    상기 메타데이터의 상기 백업 데이터는
    상기 데이터베이스에 대한 쓰기 트랜잭션 수행 시, 상기 메타데이터가 업데이트되는지 여부를 판단하는 동작;
    상기 메타데이터가 업데이트된다면, 상기 메타데이터에 대한 백업 데이터를 생성하는 동작; 및
    상기 백업 데이터에 대한 생성이 실패하면, 상기 백업 데이터를 이전 상태로 롤백하는 동작
    에 기반하여 결정되는,
    전자 장치의 동작 방법.
  14. 제13항에 있어서,
    상기 메타데이터가 업데이트되었는지 여부를 판단하는 동작은
    상기 메타데이터의 특정 부분이 업데이트되는지 여부를 판단하고,
    상기 특정 부분은 DB 헤더 또는 DB 스키마(schema) 중 적어도 하나를 포함하는,
    전자 장치의 동작 방법.
  15. 제14항에 있어서,
    상기 메타데이터의 상기 특정 부분이 업데이트되고, 상기 백업 데이터의 생성이 성공한 경우, DB 쓰기 트랜잭션 커밋을 지시하는 동작
    을 더 포함하는
    전자 장치의 동작 방법.
PCT/KR2022/015546 2021-11-15 2022-10-14 데이터베이스를 복구하는 전자 장치 및 그 동작 방법 WO2023085619A1 (ko)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22893042.6A EP4345624A1 (en) 2021-11-15 2022-10-14 Electronic device for recovering database and operation method thereof
US17/994,229 US20230153291A1 (en) 2021-11-15 2022-11-25 Electronic device for recovering database and method of operating the same

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
KR10-2021-0156549 2021-11-15
KR20210156549 2021-11-15
KR1020210168020A KR20230070986A (ko) 2021-11-15 2021-11-30 데이터베이스를 복구하는 전자 장치 및 그 동작 방법
KR10-2021-0168020 2021-11-30

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/994,229 Continuation US20230153291A1 (en) 2021-11-15 2022-11-25 Electronic device for recovering database and method of operating the same

Publications (1)

Publication Number Publication Date
WO2023085619A1 true WO2023085619A1 (ko) 2023-05-19

Family

ID=86336364

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2022/015546 WO2023085619A1 (ko) 2021-11-15 2022-10-14 데이터베이스를 복구하는 전자 장치 및 그 동작 방법

Country Status (1)

Country Link
WO (1) WO2023085619A1 (ko)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007272493A (ja) * 2006-03-31 2007-10-18 Nec Corp コンピュータシステム、データの正常性確認方法、及び、プログラム
KR20100126069A (ko) * 2009-05-22 2010-12-01 삼성전자주식회사 메모리 장치 및 메모리 장치의 동작 방법
JP2013222467A (ja) * 2012-04-16 2013-10-28 Samsung Electronics Co Ltd 電子装置及びその制御方法
US20200073832A1 (en) * 2018-08-28 2020-03-05 Dell Products L.P. Systems And Methods For Hiding Operating System Kernel Data In System Management Mode Memory To Thwart User Mode Side-Channel Attacks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007272493A (ja) * 2006-03-31 2007-10-18 Nec Corp コンピュータシステム、データの正常性確認方法、及び、プログラム
KR20100126069A (ko) * 2009-05-22 2010-12-01 삼성전자주식회사 메모리 장치 및 메모리 장치의 동작 방법
JP2013222467A (ja) * 2012-04-16 2013-10-28 Samsung Electronics Co Ltd 電子装置及びその制御方法
US20200073832A1 (en) * 2018-08-28 2020-03-05 Dell Products L.P. Systems And Methods For Hiding Operating System Kernel Data In System Management Mode Memory To Thwart User Mode Side-Channel Attacks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JERZY KACZMAREK; MICHAL R. WROBEL: "Operating system security by integrity checking and recovery using write‐protected storage", IET INFORMATION SECURITY, THE INSTITUTION OF ENGINEERING AND TECHNOLOGY, MICHAEL FARADAY HOUSE, SIX HILLS WAY, STEVENAGE, HERTS. SG1 2AY, UK, vol. 8, no. 2, 1 March 2014 (2014-03-01), Michael Faraday House, Six Hills Way, Stevenage, Herts. SG1 2AY, UK , pages 122 - 131, XP006105369, ISSN: 1751-8709, DOI: 10.1049/iet-ifs.2012.0346 *

Similar Documents

Publication Publication Date Title
WO2020171571A1 (en) Electronic device and method for managing database
WO2017209508A1 (ko) 전자 장치 및 전자 장치의 파일 데이터 저널링 방법
WO2017069595A1 (en) Electronic device and method for executing function using speech recognition thereof
WO2017164585A1 (en) Electronic device and control method thereof
EP3843356B1 (en) Management method for model files, terminal device and computer-readable storage medium
WO2018026164A1 (en) Method of processing touch events and electronic device adapted thereto
WO2019059671A1 (en) ELECTRONIC DEVICE AND ITS CONTROL METHOD
EP3353642A1 (en) Method for providing events corresponding to touch attributes and electronic device thereof
WO2017188738A1 (en) Electronic apparatus and method for displaying object
WO2022154414A1 (ko) 전자 장치 및 전자 장치의 스토리지 운영 방법
WO2023085619A1 (ko) 데이터베이스를 복구하는 전자 장치 및 그 동작 방법
WO2023153768A1 (ko) 전자 장치에서 데이터베이스 파일을 복구하는 방법
KR20210016913A (ko) 데이터베이스의 데이터 유실을 방지하기 위한 전자 장치 및 전자 장치의 동작 방법
WO2022186460A1 (ko) 보안 데이터 처리 방법 및 장치
KR20230070986A (ko) 데이터베이스를 복구하는 전자 장치 및 그 동작 방법
WO2023075086A1 (ko) 캐시 손상을 관리하는 장치 및 그 동작 방법
US20230153291A1 (en) Electronic device for recovering database and method of operating the same
WO2024172475A1 (ko) 전자 장치 및 그의 데이터 베이스 보호 방법
WO2022154262A1 (ko) 예약 공간에 기반한 데이터베이스 업데이트 방법 및 장치
WO2022080652A1 (ko) 저널 파일을 관리하는 전자 장치 및 이의 동작 방법
WO2022240031A1 (ko) 전자 장치 및 전자 장치의 파일 관리 방법
WO2021040456A1 (ko) 파일 시스템에 저장된 파일 또는 디렉토리의 크기를 획득하기 위한 전자 장치 및 방법
WO2024034841A1 (ko) 지정된 이벤트에 기반하여 파일을 컴파일하기 위한 전자 장치 및 그 방법
WO2023101195A1 (ko) 전자 장치 및 전자 장치의 파일 시스템 운영 방법
WO2023085589A1 (ko) 전자 장치의 초기화 상황에서 데이터 보존 방법 및 그 전자 장치

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22893042

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022893042

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2022893042

Country of ref document: EP

Effective date: 20231228