ConditionalIndex: bug or feature?

Let's imagine that we have ConditionalIndex with filter on the fields X and Y, and this index was built by the extractor, which returns the value of a Z field, so I'm expecting that the behavior is something like this:

public void onUpdate() {
    if (filter.evaluate(entry)) {
        Object value = extractor.extract(entry);
        index.update(entry.getKey(), value);
    }
}

public void onInsert() {
     // the same behaviour as for on Update()
}

But in fact index is not updated in the following cases:

(1) cached entry. Given that the fields X and there are no filter, index will not be updated

(2) updated entry in the cache (no matter by put () or EntryProcessor). Now X and meeting filter, index BUT will not be updated because the field Z (indexed field) has not been changed

Is this a bug or feature?

We use 3.7.1.5 consistency

Hi Alexey

I'd say it's a bug. I tested it with the test below which fails to 3.7.1.7 and it looks like it is still divided into 12.1.2.

import com.tangosol.io.pof.ConfigurablePofContext;
import com.tangosol.io.pof.annotation.Portable;
import com.tangosol.io.pof.annotation.PortableProperty;
import com.tangosol.net.BackingMapManagerContext;
import com.tangosol.net.cache.BackingMapBinaryEntry;
import com.tangosol.run.xml.XmlElement;
import com.tangosol.run.xml.XmlHelper;
import com.tangosol.util.Binary;
import com.tangosol.util.ConditionalIndex;
import com.tangosol.util.ExternalizableHelper;
import com.tangosol.util.Filter;
import com.tangosol.util.MapTrigger;
import com.tangosol.util.extractor.PofExtractor;
import com.tangosol.util.filter.AndFilter;
import com.tangosol.util.filter.EqualsFilter;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class ConditionalIndexTest {

    private ConfigurablePofContext serializer;

    @Before
    public void setup() {
        XmlElement pofXML = XmlHelper.loadXml("" +
                "\n" +
                "     \n" +
                "  \n" +
                "    coherence-pof-config.xml\n" +
                "    \n" +
                "      1000\n" +
                "      " + MyDomainClass.class.getName() + "\n" +
                "    \n" +
                "  \n" +
                "");

        serializer = new ConfigurablePofContext(pofXML);
    }

    @Test
    public void shouldNotAddNonMatchingEntryOnInsert() throws Exception {
        String key = "Key-1";
        MyDomainClass domainObject = new MyDomainClass("X_1", "Y_1", "Z_1");
        Binary binaryKey = ExternalizableHelper.toBinary(key, serializer);
        Binary binaryValue = ExternalizableHelper.toBinary(domainObject, serializer);
        BinaryEntryStub entry = new BinaryEntryStub(binaryKey, binaryValue, null, null);

        Filter filter = new AndFilter(
                new EqualsFilter(new PofExtractor(String.class, 1), "X_2"),
                new EqualsFilter(new PofExtractor(String.class, 2), "Y_2")
        );

        PofExtractor extractor = new PofExtractor(String.class, 3);

        ConditionalIndex index = new ConditionalIndex(filter, extractor, false, null, true, null);
        index.insert(entry);
        assertThat(index.getIndexContents().isEmpty(), is(true));
        assertThat(index.isPartial(), is(true));
    }

    @Test
    public void shouldAddMatchingEntryIndexOnUpdateWhenExtractedFieldHasNotChanged() throws Exception {
        String key = "Key-1";
        Binary binaryKey = ExternalizableHelper.toBinary(key, serializer);

        MyDomainClass domainObjectOriginal = new MyDomainClass("X_1", "Y_1", "Z_1");
        Binary binaryValueOriginal = ExternalizableHelper.toBinary(domainObjectOriginal, serializer);
        BinaryEntryStub entryInsert = new BinaryEntryStub(binaryKey, binaryValueOriginal, null, null);

        MyDomainClass domainObjectUpdate = new MyDomainClass("X_2", "Y_2", "Z_1");
        Binary binaryValueUpdate = ExternalizableHelper.toBinary(domainObjectUpdate, serializer);
        BinaryEntryStub entryUpdate = new BinaryEntryStub(binaryKey, binaryValueUpdate, binaryValueOriginal, null);

        Filter filter = new AndFilter(
                new EqualsFilter(new PofExtractor(String.class, 1), "X_2"),
                new EqualsFilter(new PofExtractor(String.class, 2), "Y_2")
        );

        PofExtractor extractor = new PofExtractor(String.class, 3);

        ConditionalIndex index = new ConditionalIndex(filter, extractor, false, null, true, null);
        index.insert(entryInsert);
        index.update(entryUpdate);

        assertThat(index.getIndexContents().isEmpty(), is(false));
        assertThat((String) index.get(binaryKey), is("Z_1"));
    }

    @Test
    public void shouldAddMatchingEntryIndexOnUpdateWhenExtractedFieldHasChanged() throws Exception {
        String key = "Key-1";
        Binary binaryKey = ExternalizableHelper.toBinary(key, serializer);

        MyDomainClass domainObjectOriginal = new MyDomainClass("X_1", "Y_1", "Z_1");
        Binary binaryValueOriginal = ExternalizableHelper.toBinary(domainObjectOriginal, serializer);
        BinaryEntryStub entryInsert = new BinaryEntryStub(binaryKey, binaryValueOriginal, null, null);

        MyDomainClass domainObjectUpdate = new MyDomainClass("X_2", "Y_2", "Z_2");
        Binary binaryValueUpdate = ExternalizableHelper.toBinary(domainObjectUpdate, serializer);
        BinaryEntryStub entryUpdate = new BinaryEntryStub(binaryKey, binaryValueUpdate, binaryValueOriginal, null);

        Filter filter = new AndFilter(
                new EqualsFilter(new PofExtractor(String.class, 1), "X_2"),
                new EqualsFilter(new PofExtractor(String.class, 2), "Y_2")
        );

        PofExtractor extractor = new PofExtractor(String.class, 3);

        ConditionalIndex index = new ConditionalIndex(filter, extractor, false, null, true, null);
        index.insert(entryInsert);
        index.update(entryUpdate);

        assertThat(index.getIndexContents().isEmpty(), is(false));
        assertThat((String) index.get(binaryKey), is("Z_2"));
    }

    @Portable
    public static class MyDomainClass {
        @PortableProperty(value = 1)
        private String fieldX;
        @PortableProperty(value = 2)
        private String fieldY;
        @PortableProperty(value = 3)
        private String fieldZ;

        public MyDomainClass() {
        }

        public MyDomainClass(String fieldX, String fieldY, String fieldZ) {
            this.fieldX = fieldX;
            this.fieldY = fieldY;
            this.fieldZ = fieldZ;
        }
    }

    private class BinaryEntryStub extends BackingMapBinaryEntry implements MapTrigger.Entry {

        private BinaryEntryStub(Binary binKey, Binary binValue, Binary binValueOrig, BackingMapManagerContext ctx) {
            super(binKey, binValue, binValueOrig, ctx);
        }

        @Override
        public boolean isOriginalPresent() {
            return getOriginalBinaryValue() != null;
        }
    }

}

}
}

JK

Tags: Fusion Middleware

Similar Questions

  • Bug or feature limitation: cannot pin header on version site telephone

    Hello

    Check out this file. Watch it in phone mode. Listen to samples and note that I can't pin the header/NAV.

    Bug or feature limitation?

    Dropbox - MicrositeRedesign04.muse.zip

    Dave

    Setting to 1 it will scroll the scrolling speed. You want it to be 0, so it does not scroll at all.

  • Clear recent history + cookies clears all cookies, including those on the list of exceptions - bug or feature?

    I have several sites on the list of the persons authorized to keep the cookies always (options, privacy, cookies, exceptions). When I use "clear recent history" and check the cookies, the cookies are deleted, including those on the allowed list. Maybe it's a feature rather than a bug, but I much prefer it if cookies excepted were excluded.

    This is how it works. Using clear recent history clears all specified cookies and does not exclude cookies that have an exception permit. If you want to keep a few cookies then you should avoid using CRH to clear the cookies and delete unwanted cookies in the Cookie Manager or they expire when you close Firefox. In this way you keep the cookies with an exception permit.

  • Multi day Passport BlackBerry calendar events: Bug or feature?

    I have a three day event.

    The month view shows the event only on the day of departure, that the other two days are not marked.

    In comparison my 10.2.1 device (Z10, Z30): all days are marked by the appointment. And also in the color of the calendar, on 10.3 all appointments are gray.

    It's supposed to be a new feature, or is it just a bug?

    Hi @simon_hain

    I was able to reproduce this problem, and it has connected with our development team. Updates, to bookmark this KB.

    KB36389 appointments that span several days are not properly presented in the monthly view

    Thank you!

  • [bug or feature] remove relationship result empty index

    Hello

    After the removal of a 1:1 ratio in the logic model and engineer that this deletion of relational model, the relationship is on relational model. But the index in the target remains and the index is empty. The generation of DDL displays the errors later.

    Is this a feature? Or: How can I remove the relationship without getting the index of vacuum?

    (tried with 4.0.3 and 4.1, same results)

    before:

    before.jpg

    After:

    after.jpg

    Hello

    Thank you to let know us the problem - I logged a bug for this.

    You can check the 'Analyses of Impact' page to see the dependent objects before the delete operation:

    Philippe

  • Bugs or features of NoSQL create table

    Hi, I used the runadmin CLI command to create a pattern with several tables and child tables (create table), reflecting our logistics OAGIS model BO.

    The following clothe are bugs in runadmin, I think:

    * children tables have a key with the same name as the name of the key of one of their parents? Why?

    adding a few records (add-registration-field) of the same structure (structure to address typical e.g.a) only works for the first, for example postalAddress. When you add an invoiceAddress of the same type, the error "Unknown Exception: class org.apache.avro.SchemaParseException ' appears at the output. Children tables for that aid works. With the help of several records from a same simple structure works, and I think that the error occurs when the records have a field with the same name as the key of the table.

    * In addition, I miss a feature like - AutoNumber to use keys by default. It is available or planned or displaced in the application layer?

    Hello

    Some good questions.

    | * children tables have a key with the same name as the name of the key of one of their parents? Why?

    As you are suggesting this restriction exists only for the fields that are part of the primary key.  A key field in a child table may have the same name as a key field in the parent.  This restriction makes a number of simpler and more efficient internal implementation details.  Do you have a use case where it is annoying?

    | adding a few records (add-registration-field) of the same structure (structure to address typical e.g.a) only works for the first, for example postalAddress. When you add an invoiceAddress of the same type, the error "Unknown Exception: class org.apache.avro.SchemaParseException ' appears at the output. Children tables for that aid works. With the help of several records from a same simple structure works, and I think that the error occurs when the records have a field with the same name as the key of the table.

    A specific example of this behavior would be helpful.  It may be a bug.

    | * In addition, I miss a feature like - AutoNumber to use keys by default. It is available or planned or displaced in the application layer?

    It is the responsibility of the application.

    Kind regards

    George

  • Bugs and feature requests

    How and where we make bug reports and requests for features on this new beta?

    Hi Tommy,.

    Come here to post on the forum.

    Neil

  • Set the style to null does not reset the attributes of police - Bug or feature?

    I call setStyle ("police - fx - weight:" BOLD "") with a label - the label text is in bold.
    Then I call setStyle (null) with the same label - now awaits the etiquette police returned to the definition of the CSS.

    But: the label does not indicate a normal font now - it's always "BOLD".
    I have to explicitly call setStyle ("police - fx - weight: normal") in order to bring it back to the normal font.

    Is this a bug or a feature?
    If it is a bug, so I'll post a message-Jira, but I'm still not 100% sure...

    My FX version is 2.2.

    Thanks + regards!
    Björn



    Code examples:
    package ztest;
    
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.SceneBuilder;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    
    public class Test_62_FontStyle 
        extends Application
    {
        public static void main(String[] args)
        {
            launch(args);
        }
    
        boolean m_bold = false;
        VBox m_vb = new VBox();
        Label m_la = new Label("Some text to be styled.");
        Button m_bu = new Button("Change");
        
        @Override
        public void start(Stage primaryStage)
        {
            final Scene scene = SceneBuilder.create()
                 .root
                 (
                      m_vb
                 )
                 .build();
            
            m_vb.getChildren().add(m_la);
            m_vb.getChildren().add(m_bu);
            
            m_bu.addEventHandler(ActionEvent.ACTION,new EventHandler<ActionEvent>()
            {
                @Override
                public void handle(ActionEvent paramT)
                {
                    m_bold = !m_bold;
                    if (m_bold == true)
                        m_la.setStyle("-fx-font-weight: bold");
                    else
                        m_la.setStyle(null); // does not reset font!
    //                    m_la.setStyle("-fx-font-weight: normal"); // this works fine...
                }
            });
            
            primaryStage.setScene(scene);
            primaryStage.show();
        }
        
    }

    This is a known bug: setStyle (null) and setStyle("") does not cancel a previous call setStyle()

    https://JavaFX-JIRA.Kenai.com/browse/RT-25002

  • Time Dimension type to different values in the attributes - Bug or feature?

    Not sure if this is a bug or a feature.

    But if there is a time dimension hierarchies. You have the option of specifying different values for member attributes in different hierarchies.

    For example.

    A hierarchy has MIN_ID for its members and uses MIN_END_DATE for its end_date

    Hierarchy B has MIN_ID for its members and uses SESS_END_DATE for its end_date

    According to this message and a comment by David Greenfield:

    Gender issue when several mappings for different hierarchies

    "You try to map the same attribute, SORT, on different columns in two hierarchies? In other words, what do you expect the same Member to have different values for the attribute in the two different hierarchies? If so, then this is a problem because a member must have the same value for the attribute independently of the hierarchy. »

    Unlike a dimension of the user, a time dimension seems to allow this and it seems to work as expected. Behavior in this case is the difference between a user and the time dimension?

    Your description of the structure of the dimension is very clear, but I have a question about system requirements. When you say you want to the time running from 17:00 to 16:59, do you mean that the calculation must spand day? for example "5:00 PM: Jan 1, 2012" to "4:59 PM: 2 Jan 2012".» If so, then this you is impossible by making a loop only the dimension of time-seconds. Or do you really mean it must wrap around the same day. for example "5:00 PM: Jan 1, 2012" at "11:59 PM: 1 Jan 2012", then again to "00:00 AM: 1 Jan 2012" to "4:59 PM: 1 Jan 2012"?»»»

    If you want the calculation for the period of days, then I think you need to spend TIME on the DATE dimension level. You can leave some MINUTES in the second dimension, which can be a dimension of standard user. You must then two levels of the DAY (with different members) in the date dimension - each with a different set of the child. You can assign the TIME_SPAN to the TIME level 1.

  • Where can I submit a bug or feature desired for future updates?

    My question is in Lightroom, but probably others have problems elsewhere in creative cloud.  I can't seem to find a link to ask corrects him or change in future updates of the software.  Is there such a thing?

    Thank you, Suzi

    Hi Suzi,

    If I understand your question: a way to interest Adobe development team is to use the "wishform" and maybe your "request correct or change in future updates of the software" can be used as a suggestion. Here at https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform, where you'll find this: "Use this form to request new features or suggest modifications to existing features."

    Hans-Günter

  • Copy and paste graphic inserted gives InDesigne, object not! Bug or 'feature '?

    When I copy and paste any object in Indesign (Vectorgraphics, Rectangle, Textarea, everything) it is not glued as another object, there in the form of a graph inserted paster. I use creative Cloud, to update automatically. What is a 'novelty' or a bug? Copy and paste an object-> I want a new object (editable and with same color, etc.) and not a chart inserted. I can't change all the parameters of that or something? never had this problem before!

    I would appreciate your help as it really is uncomfortable in the workflow, even though I understand it would increase performance and reduce the amount of data.

    Check your preferences to Clipboard...

  • Bug or feature?

    In InDesign CS6 is the strangest thing: whenever I open InDesign, it automatically opens the last document, even if I had closed this document before leaving InDesign before (in other words, there is no document open when I left InDesign). Maybe this is supposed to be a feature, but personally, I find it very annoying.

    check this:- http://forums.adobe.com/message/4378532

  • Bug or feature: opacity and blend-if values wiped out when convert to smart object layer

    I had unexpected results in an action that I put in place. As I was browsing through, I found that the conversion of a smart object layer reset the opacity to 100% and removed everything if mixture adjustments, if the blending mode has been retained. This is certainly an unexpected effect - is this a bug?

    Dynamic objects are always created at 100% and wipe any other mixture, mixture still exists within the object itself. It is the most logical way and reasonable so that it works - you will realize this if you think that it is through. Blend modes are however sometimes copied the layer source or group, it is possible and it is a kind of shortcut.

    To get the original mix in the smart object layer - open the smart object, do a right click on the layer with the bending choose 'copy layer style correct. " Now return to your master document, you can 'paste layer style' in the smart object layer.

    -

  • CreateInsert: table auto refresh, bug or feature?

    I noticed something strange.
    I have a table that is linked to a domain controller. I also have a button with custom code. In this code, I run the CreateInsert and open a popup.
    It works very well.

    I noticed that a blank line gets my table as soon as I press the createInsert button, however there are no partialTrigger from my table to the button. Is this a normal behavior or a bug?

    This is the code of my table:
    <af:table value="#{bindings.User.collectionModel}" var="row"
                  rows="#{bindings.User.rangeSize}"
                  emptyText="#{bindings.User.viewable ? 'No data to display.' : 'Access Denied.'}"
                  fetchSize="#{bindings.User.rangeSize}" rowBandingInterval="0"
                  filterModel="#{bindings.UserQuery.queryDescriptor}"
                  queryListener="#{bindings.UserQuery.processQuery}"
                  filterVisible="true" varStatus="vs"
                  selectedRowKeys="#{bindings.User.collectionModel.selectedRow}"
                  selectionListener="#{bindings.User.collectionModel.makeCurrent}"
                  rowSelection="single" id="t1" width="850px"
                  autoHeightRows="10" contentDelivery="immediate">
    It's the actionListener for my button:
        public void createUser(ActionEvent e) {
          BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
          OperationBinding createInsert = (OperationBinding) bindings.get("CreateInsert");
          createInsert.execute();
          
          FacesContext facesContext = FacesContext.getCurrentInstance();
          ExtendedRenderKitService service = Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
          service.addScript(facesContext,"AdfPage.PAGE.findComponent('"+popup.getClientId(facesContext) + "').show();");
        }
    My button has the partialSubmit = "true" so I don't see why the table is notified and adds the empty line.
    I want to just open the popup and show the field in the record.

    Published by: Yannick Ongena Sep 23, 2010 10:50

    Hi Yannick,

    Seems you and debugger do the same popup and Create/Insert button

    Edit: Ah, I just noticed that you say that you see the line in the table immediately... not sure that one (I see the line after rejecting the popup). I am downloading of clusters of JDev extensions right now, so I can't test my approach immediately, but I'll do it soon.

    Note: I recommend that you use the API server to display the popup rather than injecting JavaScript - see my sample code to this other thread - this method to display a popup is the way documented to do so in an actionlistener.

    John

  • LV7.1 - property within a node loop - bug or feature?

    Using LV7.1, I tried to create a node property for a control on front panel which lay in a loop on the block diagram. The resulting node has an outline of the shadow and I couldn't move it at all.  However, when I moved out of the loop control and created the node here, I could move both within the loop with no problems.  I have reproduced this behavior with several programs different test (simple), so he has not been given to my VI.  Is this a case of LV trying to 'tell me something', or was it a known issue in 7.1?

    Thank you.

    Michael Tracy

    Synergy microwave

    After playing with it more, I finally discovered that it was a single user (for example, nut-behind-the-wheel) error.  I continued to try select the floating node using the contour selection function and it does not work, but when I did the mouse over it carefully, I managed the transition from click - drag, no problem.  Oh, well, live and learn!

    Michael

Maybe you are looking for